
    Y j9                        S r SSKJr  SSKJrJr   " S S\5      r " S S\5      r " S S	\	5      r
 " S
 S\5      r " S S\\5      r " S S\\5      r " S S\5      r " S S\\5      r " S S\5      r " S S\5      r " S S\5      r " S S\5      r " S S\5      r " S S\5      r " S  S!\5      r " S" S#\5      r " S$ S%\5      r " S& S'\5      r " S( S)\5      r " S* S+\5      r " S, S-\5      r  " S. S/\5      r! " S0 S1\!5      r" " S2 S3\5      r# " S4 S5\5      r$ " S6 S7\5      r% " S8 S9\\%5      r& " S: S;\'\%5      r( " S< S=\\5      r) " S> S?\5      r* " S@ SA\*5      r+ " SB SC\*5      r, " SD SE\,5      r- " SF SG\5      r. " SH SI\.5      r/ " SJ SK\.5      r0 " SL SM\.5      r1 " SN SO\5      r2 " SP SQ\25      r3 " SR SS\25      r4 " ST SU\5      r5 " SV SW\5      r6 " SX SY\65      r7 " SZ S[\65      r8g\)]zContains all custom errors.    )Path)	HTTPErrorResponsec                   P   ^  \ rS rSr% Sr\\-  \S'   S\S\\-  4U 4S jjrSr	U =r
$ )CacheNotFound   z9Exception thrown when the Huggingface cache is not found.	cache_dirmsgc                 :   > [         TU ]  " U/UQ70 UD6  X l        g N)super__init__r	   )selfr
   r	   argskwargs	__class__s        g/root/GenerationalWealth/GenerationalWealth/venv/lib/python3.13/site-packages/huggingface_hub/errors.pyr   CacheNotFound.__init__   s    .t.v."    )r	   )__name__
__module____qualname____firstlineno____doc__strr   __annotations__r   __static_attributes____classcell__r   s   @r   r   r      s,    CTz#C #C$J # #r   r   c                       \ rS rSrSrSrg)CorruptedCacheException   zGException for any unexpected structure in the Huggingface cache-system. Nr   r   r   r   r   r   r#   r   r   r!   r!      s    Qr   r!   c                       \ rS rSrSrSrg)LocalTokenNotFoundError   z0Raised if local token is required but not found.r#   Nr$   r#   r   r   r&   r&          :r   r&   c                       \ rS rSrSrSrg)OfflineModeIsEnabled#   zTRaised when a request is made but `HF_HUB_OFFLINE=1` is set as environment variable.r#   Nr$   r#   r   r   r*   r*   #   s    ^r   r*   c            	          ^  \ rS rSrSrSS.S\S\S\S-  4U 4S jjjrS	\S
S4S jr\	S\S\S\S-  S
S 4S j5       r
S rSrU =r$ )HfHubHTTPError'   a>  
    HTTPError to inherit from for any custom HTTP Error raised in HF Hub.

    Any HTTPError is converted at least into a `HfHubHTTPError`. If some information is
    sent back by the server, it will be added to the error message.

    Added details:
    - Request ID sourced from headers in order of precedence: "X-Request-Id", "X-Amzn-Trace-Id", "X-Amz-Cf-Id".
    - Server error message from the header "X-Error-Message".
    - Server error message if we can found one in the response body.

    Example:
    ```py
        import httpx
        from huggingface_hub.utils import get_session, hf_raise_for_status, HfHubHTTPError

        response = get_session().post(...)
        try:
            hf_raise_for_status(response)
        except HfHubHTTPError as e:
            print(str(e)) # formatted message
            e.request_id, e.server_message # details returned by server

            # Complete the error message with additional information once it's raised
            e.append_to_message("
`create_commit` expects the repository to exist.")
            raise
    ```
    N)server_messagemessageresponser/   c                &  > UR                   R                  S5      =(       d=    UR                   R                  S5      =(       d    UR                   R                  S5      U l        X0l        X l        UR
                  U l        [        TU ]  U5        g )Nzx-request-idzX-Amzn-Trace-Idzx-amz-cf-id)headersget
request_idr/   r1   requestr   r   )r   r0   r1   r/   r   s       r   r   HfHubHTTPError.__init__E   sz       0 3##$563##M2 	
 - ''!r   additional_messagereturnc                 T    U R                   S   U-   4U R                   SS -   U l         g)zFAppend additional information to the `HfHubHTTPError` initial message.r      N)r   )r   r8   s     r   append_to_message HfHubHTTPError.append_to_messageV   s)    YYq\$668499QR=H	r   c                     U " XUS9$ )N)r1   r/   r#   )clsr0   r1   r/   s       r   _reconstruct_hf_hub_http_error-HfHubHTTPError._reconstruct_hf_hub_http_errorZ   s     7nMMr   c                 r    U R                   R                  [        U 5      U R                  U R                  44$ )zeFix pickling of Exception subclass with kwargs. We need to override __reduce_ex__ of the parent class)r   r@   r   r1   r/   )r   protocols     r   __reduce_ex__HfHubHTTPError.__reduce_ex__`   s-    ==D	4==Z^ZmZm?noor   )r   r6   r5   r1   r/   )r   r   r   r   r   r   r   r   r<   classmethodr@   rD   r   r   r   s   @r   r-   r-   '   s    D &*"" 	"
 d
" ""IC ID I NN%-N?BTzN	N N
p pr   r-   c                       \ rS rSrSrSrg)InferenceTimeoutErrorh   zBError raised when a model is unavailable or the request times out.r#   Nr$   r#   r   r   rH   rH   h   s    Lr   rH   c                       \ rS rSrSrSrg)InferenceEndpointErroro   z8Generic exception when dealing with Inference Endpoints.r#   Nr$   r#   r   r   rK   rK   o   s    Br   rK   c                       \ rS rSrSrSrg)InferenceEndpointTimeoutErrors   z<Exception for timeouts while waiting for Inference Endpoint.r#   Nr$   r#   r   r   rN   rN   s   s    Fr   rN   c                       \ rS rSrSrSrg)SafetensorsParsingErrorz   zRaised when failing to parse a safetensors file metadata.

This can be the case if the file is not a safetensors file or does not respect the specification.
r#   Nr$   r#   r   r   rQ   rQ   z       r   rQ   c                       \ rS rSrSrSrg)NotASafetensorsRepoError   zRaised when a repo is not a Safetensors repo i.e. doesn't have either a `model.safetensors` or a
`model.safetensors.index.json` file.
r#   Nr$   r#   r   r   rU   rU      s    r   rU   c                       \ rS rSrSrSrg)TextGenerationError   z3Generic error raised if text-generation went wrong.r#   Nr$   r#   r   r   rX   rX          =r   rX   c                       \ rS rSrSrSrg)ValidationError   zServer-side validation error.r#   Nr$   r#   r   r   r\   r\      s    'r   r\   c                       \ rS rSrSrg)GenerationError   r#   Nr   r   r   r   r   r#   r   r   r_   r_          r   r_   c                       \ rS rSrSrg)OverloadedError   r#   Nra   r#   r   r   rd   rd      rb   r   rd   c                       \ rS rSrSrg)IncompleteGenerationError   r#   Nra   r#   r   r   rg   rg      rb   r   rg   c                       \ rS rSrSrg)UnknownError   r#   Nra   r#   r   r   rj   rj      rb   r   rj   c                       \ rS rSrSrSrg)HFValidationError   zGeneric exception thrown by `huggingface_hub` validators.

Inherits from [`ValueError`](https://docs.python.org/3/library/exceptions.html#ValueError).
r#   Nr$   r#   r   r   rm   rm      rS   r   rm   c                   8   ^  \ rS rSrSrS\S\4U 4S jjrSrU =r$ )
HfUriError   a$  Raised when an `hf://...` URI is malformed.

See [`parse_hf_uri`] and the
[HF URIs reference](https://huggingface.co/docs/huggingface_hub/main/en/package_reference/hf_uris)
for the canonical syntax.

Inherits from [`ValueError`](https://docs.python.org/3/library/exceptions.html#ValueError).
urir
   c                 d   > Xl         X l        U(       a  SU SU 3OSU 3n[        TU ]  U5        g )NzInvalid HF URI 'z'. zInvalid HF URI. )rr   r
   r   r   )r   rr   r
   full_msgr   s       r   r   HfUriError.__init__   s;    7:%cU#cU3BRSVRW@X"r   )r
   rr   	r   r   r   r   r   r   r   r   r   r   s   @r   rp   rp      s     #C #c # #r   rp   c                       \ rS rSrSrSrg)DryRunError   zXError triggered when a dry run is requested but cannot be performed (e.g. invalid repo).r#   Nr$   r#   r   r   rx   rx          br   rx   c                       \ rS rSrSrSrg)FileMetadataError   zError triggered when the metadata of a file on the Hub cannot be retrieved (missing ETag or commit_hash).

Inherits from `OSError` for backward compatibility.
r#   Nr$   r#   r   r   r|   r|      rS   r   r|   c                   .    \ rS rSr% SrSr\S-  \S'   Srg)BucketNotFoundError   a  
Raised when trying to access a bucket that does not exist.

Attributes:
    bucket_id (`str` or `None`):
        The bucket id (namespace/name) that was not found, if it could be determined from the request URL.

Example:

```py
>>> from huggingface_hub import bucket_info
>>> bucket_info("<non_existent_bucket>")
(...)
huggingface_hub.errors.BucketNotFoundError: 404 Client Error. (Request ID: XXX)

Bucket Not Found for url: https://huggingface.co/api/buckets/namespace/name.
Please make sure you specified the correct bucket id (namespace/name).
If the bucket is private, make sure you are authenticated and your token has the required permissions.
```
N	bucket_idr#   )	r   r   r   r   r   r   r   r   r   r#   r   r   r   r      s    * !IsTz r   r   c                   B    \ rS rSr% SrSr\S-  \S'   Sr\S-  \S'   Sr	g)RepositoryNotFoundError   a  
Raised when trying to access a hf.co URL with an invalid repository name, or
with a private repo name the user does not have access to.

Attributes:
    repo_id (`str` or `None`):
        The repo id that was not found, if it could be determined from the request URL.
    repo_type (`str` or `None`):
        The repo type ("model", "dataset", or "space"), if it could be determined from the request URL.

Example:

```py
>>> from huggingface_hub import model_info
>>> model_info("<non_existent_repository>")
(...)
huggingface_hub.errors.RepositoryNotFoundError: 401 Client Error. (Request ID: PvMw_VjBMjVdMz53WKIzP)

Repository Not Found for url: https://huggingface.co/api/models/%3Cnon_existent_repository%3E.
Please make sure you specified the correct `repo_id` and `repo_type`.
If the repo is private, make sure you are authenticated and your token has the required permissions.
Invalid username or password.
```
Nrepo_id	repo_typer#   
r   r   r   r   r   r   r   r   r   r   r#   r   r   r   r      s%    2 GS4Z IsTz r   r   c                       \ rS rSrSrSrg)GatedRepoErrori	  a  
Raised when trying to access a gated repository for which the user is not on the
authorized list.

Note: derives from `RepositoryNotFoundError` to ensure backward compatibility.

Example:

```py
>>> from huggingface_hub import model_info
>>> model_info("<gated_repository>")
(...)
huggingface_hub.errors.GatedRepoError: 403 Client Error. (Request ID: ViT1Bf7O_026LGSQuVqfa)

Cannot access gated repo for url https://huggingface.co/api/models/ardent-figment/gated-model.
Access to model ardent-figment/gated-model is restricted and you are not in the authorized list.
Visit https://huggingface.co/ardent-figment/gated-model to ask for access.
```
r#   Nr$   r#   r   r   r   r   	  s    r   r   c                       \ rS rSrSrSrg)DisabledRepoErrori  a  
Raised when trying to access a repository that has been disabled by its author.

Example:

```py
>>> from huggingface_hub import dataset_info
>>> dataset_info("laion/laion-art")
(...)
huggingface_hub.errors.DisabledRepoError: 403 Client Error. (Request ID: Root=1-659fc3fa-3031673e0f92c71a2260dbe2;bc6f4dfb-b30a-4862-af0a-5cfe827610d8)

Cannot access repository for url https://huggingface.co/api/datasets/laion/laion-art.
Access to this resource is disabled.
```
r#   Nr$   r#   r   r   r   r         r   r   c                   B    \ rS rSr% SrSr\S-  \S'   Sr\S-  \S'   Sr	g)RevisionNotFoundErrori4  a  
Raised when trying to access a hf.co URL with a valid repository but an invalid
revision.

Attributes:
    repo_id (`str` or `None`):
        The repo id, if it could be determined from the request URL.
    repo_type (`str` or `None`):
        The repo type ("model", "dataset", or "space"), if it could be determined from the request URL.

Example:

```py
>>> from huggingface_hub import hf_hub_download
>>> hf_hub_download('bert-base-cased', 'config.json', revision='<non-existent-revision>')
(...)
huggingface_hub.errors.RevisionNotFoundError: 404 Client Error. (Request ID: Mwhe_c3Kt650GcdKEFomX)

Revision Not Found for url: https://huggingface.co/bert-base-cased/resolve/%3Cnon-existent-revision%3E/config.json.
```
Nr   r   r#   r   r#   r   r   r   r   4  %    , GS4Z IsTz r   r   c                       \ rS rSrSrSrg)EntryNotFoundErroriP  a  
Raised when entry not found, either locally or remotely.

Example:

```py
>>> from huggingface_hub import hf_hub_download
>>> hf_hub_download('bert-base-cased', '<non-existent-file>')
(...)
huggingface_hub.errors.RemoteEntryNotFoundError (...)
>>> hf_hub_download('bert-base-cased', '<non-existent-file>', local_files_only=True)
(...)
huggingface_hub.utils.errors.LocalEntryNotFoundError (...)
```
r#   Nr$   r#   r   r   r   r   P  r   r   r   c                   B    \ rS rSr% SrSr\S-  \S'   Sr\S-  \S'   Sr	g)RemoteEntryNotFoundErrorib  a  
Raised when trying to access a hf.co URL with a valid repository and revision
but an invalid filename.

Attributes:
    repo_id (`str` or `None`):
        The repo id, if it could be determined from the request URL.
    repo_type (`str` or `None`):
        The repo type ("model", "dataset", or "space"), if it could be determined from the request URL.

Example:

```py
>>> from huggingface_hub import hf_hub_download
>>> hf_hub_download('bert-base-cased', '<non-existent-file>')
(...)
huggingface_hub.errors.EntryNotFoundError: 404 Client Error. (Request ID: 53pNl6M0MxsnG5Sw8JA6x)

Entry Not Found for url: https://huggingface.co/bert-base-cased/resolve/main/%3Cnon-existent-file%3E.
```
Nr   r   r#   r   r#   r   r   r   r   b  r   r   r   c                   4   ^  \ rS rSrSrS\4U 4S jjrSrU =r$ )LocalEntryNotFoundErrori}  a  
Raised when trying to access a file or snapshot that is not on the disk when network is
disabled or unavailable (connection issue). The entry may exist on the Hub.

Example:

```py
>>> from huggingface_hub import hf_hub_download
>>> hf_hub_download('bert-base-cased', '<non-cached-file>',  local_files_only=True)
(...)
huggingface_hub.errors.LocalEntryNotFoundError: Cannot find the requested files in the disk cache and outgoing traffic has been disabled. To enable hf.co look-ups and downloads online, set 'local_files_only' to False.
```
r0   c                 $   > [         TU ]  U5        g r   )r   r   )r   r0   r   s     r   r    LocalEntryNotFoundError.__init__  s    !r   r#   rv   r   s   @r   r   r   }  s    " " "r   r   c                       \ rS rSrSrSrg)BadRequestErrori  a'  
Raised by `hf_raise_for_status` when the server returns a HTTP 400 error.

Example:

```py
>>> resp = httpx.post("hf.co/api/check", ...)
>>> hf_raise_for_status(resp, endpoint_name="check")
huggingface_hub.errors.BadRequestError: Bad request for check endpoint: {details} (Request ID: XXX)
```
r#   Nr$   r#   r   r   r   r     s    
r   r   c                       \ rS rSrSrSrg)	DDUFErrori  z5Base exception for errors related to the DDUF format.r#   Nr$   r#   r   r   r   r     s    ?r   r   c                       \ rS rSrSrSrg)DDUFCorruptedFileErrori  z1Exception thrown when the DDUF file is corrupted.r#   Nr$   r#   r   r   r   r         ;r   r   c                       \ rS rSrSrSrg)DDUFExportErrori  z-Base exception for errors during DDUF export.r#   Nr$   r#   r   r   r   r     s    7r   r   c                       \ rS rSrSrSrg)DDUFInvalidEntryNameErrori  z0Exception thrown when the entry name is invalid.r#   Nr$   r#   r   r   r   r     r(   r   r   c                       \ rS rSrSrSrg)StrictDataclassErrori  z&Base exception for strict dataclasses.r#   Nr$   r#   r   r   r   r     s    0r   r   c                       \ rS rSrSrSrg)StrictDataclassDefinitionErrori  z@Exception thrown when a strict dataclass is defined incorrectly.r#   Nr$   r#   r   r   r   r     s    Jr   r   c                   8   ^  \ rS rSrSrS\S\4U 4S jjrSrU =r	$ )#StrictDataclassFieldValidationErrori  zLException thrown when a strict dataclass fails validation for a given field.fieldcausec                 n   > SU S3nUSUR                   R                   SU 3-  n[        TU ]  U5        g )NzValidation error for field '':
    : r   r   r   r   )r   r   r   error_messager   s       r   r   ,StrictDataclassFieldValidationError.__init__  s@    6ugR@6%//":":!;2eWEE'r   r#   
r   r   r   r   r   r   	Exceptionr   r   r   r   s   @r   r   r     s    V(c () ( (r   r   c                   8   ^  \ rS rSrSrS\S\4U 4S jjrSrU =r	$ )#StrictDataclassClassValidationErrori  zOException thrown when a strict dataclass fails validation on a class validator.	validatorr   c                 n   > SU S3nUSUR                   R                   SU 3-  n[        TU ]  U5        g )Nz&Class validation error for validator 'r   r   r   r   )r   r   r   r   r   s       r   r   ,StrictDataclassClassValidationError.__init__  s@    @2N6%//":":!;2eWEE'r   r#   r   r   s   @r   r   r     s    Y(# (i ( (r   r   c                       \ rS rSrSrSrg)XetErrori  z1Base exception for errors related to Xet Storage.r#   Nr$   r#   r   r   r   r     r   r   r   c                       \ rS rSrSrSrg)XetAuthorizationErrori  zXException thrown when the user does not have the right authorization to use Xet Storage.r#   Nr$   r#   r   r   r   r     rz   r   r   c                       \ rS rSrSrSrg)XetRefreshTokenErrori  z3Exception thrown when the refresh token is invalid.r#   Nr$   r#   r   r   r   r     rZ   r   r   c                       \ rS rSrSrSrg)XetDownloadErrori  z:Exception thrown when the download from Xet Storage fails.r#   Nr$   r#   r   r   r   r     s    Dr   r   c                       \ rS rSrSrSrg)CLIErrori  z7CLI error with clean message (no traceback by default).r#   Nr$   r#   r   r   r   r     s    Ar   r   c                       \ rS rSrSrSrg)ConfirmationErrori  zERaised when a confirmation prompt is declined (non-interactive mode).r#   Nr$   r#   r   r   r   r     s    Or   r   c                       \ rS rSrSrSrg)CLIExtensionInstallErrori  z(Error during CLI extension installation.r#   Nr$   r#   r   r   r   r     s    2r   r   N)9r   pathlibr   httpxr   r   r   r   r!   EnvironmentErrorr&   ConnectionErrorr*   OSErrorr-   TimeoutErrorrH   rK   rN   rQ   rU   rX   r\   r_   rd   rg   rj   
ValueErrorrm   rp   rx   r|   r   r   r   r   r   r   r   FileNotFoundErrorr   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r#   r   r   <module>r      sS   !  %#I #Ri R;. ;_? _;pY ;pBMI| MCY CG$:L Gi y >) >
() (	) 		) 		 3 		& 	
 # #(c' c !. !8!n !<, , *!N !8 $!~/A !6"/1C "(nj "@	 @<Y <8i 8; ;19 1K%9 K(*> ((*> (<y <cH c>8 >Ey EBy BP P3x 3r   