Team Ai
Datasetpublic

codekingpro/portable-devtools

sourceHugging Faceupdated 5mo agoView on Hugging Face
1likes14kdownloads
errors.cpython-313.pyc224 linesDownload Raw Back to __pycache__
1�

2��j�9����SrSSKJr SSKJrJr "SS\5r"SS\5r"SS	\	5r3"S4S\5r"SS
\\
5r"SS\\5r"SS\5r"SS\\5r"SS\5r"SS\5r"SS\5r"SS\5r"SS\5r"SS\5r"S S!\5r"S"S#\5r"S$S%\5r"S&S'\5r"S(S)\
5r"S*S+\
5r"S,S-\5r "S.S/\5r!"S0S1\!5r""S2S3\5r#"S4S5\5r$"S6S7\5r%"S8S9\\%5r&"S:S;\'\%5r("S<S=\\5r)"S>S?\5r*"S@SA\*5r+"SBSC\*5r,"SDSE\,5r-"SFSG\5r."SHSI\.5r/"SJSK\.5r0"SLSM\.5r1"SNSO\5r2"SPSQ\25r3"SRSS\25r4"STSU\5r5"SVSW\5r6"SXSY\65r7"SZS[\65r8g\)]zContains all custom errors.�)�Path)�	HTTPError�Responsec�P^�\rSrSr%Sr\\-\S'S\S\\-4U4SjjrSr	U=r5$)�
CacheNotFound�z9Exception thrown when the Huggingface cache is not found.�	cache_dir�msgc�:>�[TU]"U/UQ70UD6 X lg�N)�super�__init__r	)�selfr6r	�args�kwargs�	__class__s     ��\D:\code\apps\devtools\python\user_packages\Python313\site-packages\huggingface_hub/errors.pyr�CacheNotFound.__init__s���
����.�t�.�v�.�"��)r	)�__name__�7__module__�__qualname__�__firstlineno__�__doc__�strr�__annotations__r�__static_attributes__�
__classcell__�rs@rrrs,���C��T�z��#�C�#�C�$�J�#�#rrc��\rSrSrSrSrg)�CorruptedCacheException�zGException for any unexpected structure in the Huggingface cache-system.�N�rrrrrrr#rrr!r!s��Qrr!c��\rSrSrSrSrg)�LocalTokenNotFoundError�z0Raised if local token is required but not found.r#Nr$r#rrr&r&���:rr&c��\rSrSrSrSrg)�OfflineModeIsEnabled�#zTRaised when a request is made but `HF_HUB_OFFLINE=1` is set as environment variable.r#Nr$r#rrr*r*#s��^rr*c	�^�\rSrSrSrSS.S\S\S\S-4U4SjjjrS	\S8S4Sjr\	S\S\S\S-S9S4Sj5r10S
rSrU=r
$)�HfHubHTTPError�'a>11    HTTPError to inherit from for any custom HTTP Error raised in HF Hub.12 13    Any HTTPError is converted at least into a `HfHubHTTPError`. If some information is14    sent back by the server, it will be added to the error message.15 16    Added details:17    - Request ID sourced from headers in order of precedence: "X-Request-Id", "X-Amzn-Trace-Id", "X-Amz-Cf-Id".18    - Server error message from the header "X-Error-Message".19    - Server error message if we can found one in the response body.20 21    Example:22    ```py23        import httpx24        from huggingface_hub.utils import get_session, hf_raise_for_status, HfHubHTTPError25 26        response = get_session().post(...)27        try:28            hf_raise_for_status(response)29        except HfHubHTTPError as e:30            print(str(e)) # formatted message31            e.request_id, e.server_message # details returned by server32 33            # Complete the error message with additional information once it's raised34            e.append_to_message("35`create_commit` expects the repository to exist.")36            raise37    ```38    N)�server_message�message�responser/c�&>�URRS5=(d= URRS5=(d URRS5UlX0lX lUR39Ul[TU]U5 g)Nzx-request-idzX-Amzn-Trace-Idzx-amz-cf-id)�headers�get�40request_idr/r1�requestr
r)rr0r1r/rs    �rr�HfHubHTTPError.__init__Esz���
��� � ��0�
3����#�#�$5�6�
3����#�#�M�2�	
��41-�� �
��'�'���
����!r�additional_message�returnc�T�URSU-4URSS-Ulg)zFAppend additional information to the `HfHubHTTPError` initial message.r�N)r)rr8s  r�append_to_message� HfHubHTTPError.append_to_messageVs)���Y�Y�q�\�$6�6�8�4�9�9�Q�R�=�H��	rc��U"XUS9$)N)r1r/r#)�clsr0r1r/s    r�_reconstruct_hf_hub_http_error�-HfHubHTTPError._reconstruct_hf_hub_http_errorZs���7�n�M�Mrc�r�URR[U5URUR44$)zeFix pickling of Exception subclass with kwargs. We need to override __reduce_ex__ of the parent class)rr@rr1r/)r�protocols  r�
__reduce_ex__�HfHubHTTPError.__reduce_ex__`s-�����=�=��D�	�4�=�=�Z^�Zm�Zm�?n�o�or)rr6r5r1r/)rrrrrrrrr<�classmethodr@rDrrrs@rr-r-'s�����D&*�"��"��	"�42�d�43�"�"�"I�C�I�D�I��N��N�%-�N�?B�T�z�N�	�N��N�44p�prr-c��\rSrSrSrSrg)�InferenceTimeoutError�hzBError raised when a model is unavailable or the request times out.r#Nr$r#rrrHrHhs��LrrHc��\rSrSrSrSrg)�InferenceEndpointError�oz8Generic exception when dealing with Inference Endpoints.r#Nr$r#rrrKrKos��BrrKc��\rSrSrSrSrg)�InferenceEndpointTimeoutError�sz<Exception for timeouts while waiting for Inference Endpoint.r#Nr$r#rrrNrNss��FrrNc��\rSrSrSrSrg)�SafetensorsParsingError�zz�Raised when failing to parse a safetensors file metadata.45 46This can be the case if the file is not a safetensors file or does not respect the specification.47r#Nr$r#rrrQrQz���rrQc��\rSrSrSrSrg)�NotASafetensorsRepoError�z�Raised when a repo is not a Safetensors repo i.e. doesn't have either a `model.safetensors` or a48`model.safetensors.index.json` file.49r#Nr$r#rrrUrU�s��rrUc��\rSrSrSrSrg)�TextGenerationError�z3Generic error raised if text-generation went wrong.r#Nr$r#rrrXrX����=rrXc��\rSrSrSrSrg)�ValidationError�zServer-side validation error.r#Nr$r#rrr\r\�s��'rr\c��\rSrSrSrg)�GenerationError�r#N�rrrrrr#rrr_r_����rr_c��\rSrSrSrg)�OverloadedError�r#Nrar#rrrdrd�rbrrdc��\rSrSrSrg)�IncompleteGenerationError�r#Nrar#rrrgrg�rbrrgc��\rSrSrSrg)�UnknownError�r#Nrar#rrrjrj�rbrrjc��\rSrSrSrSrg)�HFValidationError�z�Generic exception thrown by `huggingface_hub` validators.50 51Inherits from [`ValueError`](https://docs.python.org/3/library/exceptions.html#ValueError).52r#Nr$r#rrrmrm�rSrrmc�8^�\rSrSrSrS\S\4U4SjjrSrU=r$)�53HfUriError�a$Raised when an `hf://...` URI is malformed.54 55See [`parse_hf_uri`] and the56[HF URIs reference](https://huggingface.co/docs/huggingface_hub/main/en/package_reference/hf_uris)57for the canonical syntax.58 59Inherits from [`ValueError`](https://docs.python.org/3/library/exceptions.html#ValueError).60�urir61c�d>�XlX lU(aSUSU3OSU3n[TU]
U5 g)NzInvalid HF URI 'z'. zInvalid HF URI. )rrr62r
r)rrrr63�full_msgrs    �rr�HfUriError.__init__�s;�������7:�%�c�U�#�c�U�3�BR�SV�RW�@X��
����"r)r64rr�	rrrrrrrrrrs@rrprp�s ����#�C�#�c�#�#rrpc��\rSrSrSrSrg)�DryRunError��zXError triggered when a dry run is requested but cannot be performed (e.g. invalid repo).r#Nr$r#rrrxrx����brrxc��\rSrSrSrSrg)�FileMetadataError��z�Error triggered when the metadata of a file on the Hub cannot be retrieved (missing ETag or commit_hash).65 66Inherits from `OSError` for backward compatibility.67r#Nr$r#rrr|r|�rSrr|c�.�\rSrSr%SrSr\S-\S'Srg)�BucketNotFoundError��a�68Raised when trying to access a bucket that does not exist.69 70Attributes:71    bucket_id (`str` or `None`):72        The bucket id (namespace/name) that was not found, if it could be determined from the request URL.73 74Example:75 76```py77>>> from huggingface_hub import bucket_info78>>> bucket_info("<non_existent_bucket>")79(...)80huggingface_hub.errors.BucketNotFoundError: 404 Client Error. (Request ID: XXX)81 82Bucket Not Found for url: https://huggingface.co/api/buckets/namespace/name.83Please make sure you specified the correct bucket id (namespace/name).84If the bucket is private, make sure you are authenticated and your token has the required permissions.85```86N�	bucket_idr#)	rrrrrr�rrrr#rrrr�s���*!�I�s�T�z� rrc�B�\rSrSr%SrSr\S-\S'Sr\S-\S'Sr	g)�RepositoryNotFoundError��a�87Raised when trying to access a hf.co URL with an invalid repository name, or88with a private repo name the user does not have access to.89 90Attributes:91    repo_id (`str` or `None`):92        The repo id that was not found, if it could be determined from the request URL.93    repo_type (`str` or `None`):94        The repo type ("model", "dataset", or "space"), if it could be determined from the request URL.95 96Example:97 98```py99>>> from huggingface_hub import model_info100>>> model_info("<non_existent_repository>")101(...)102huggingface_hub.errors.RepositoryNotFoundError: 401 Client Error. (Request ID: PvMw_VjBMjVdMz53WKIzP)103 104Repository Not Found for url: https://huggingface.co/api/models/%3Cnon_existent_repository%3E.105Please make sure you specified the correct `repo_id` and `repo_type`.106If the repo is private, make sure you are authenticated and your token has the required permissions.107Invalid username or password.108```109N�repo_id�	repo_typer#�110rrrrrr�rrr�rr#rrr�r��s%���2�G�S�4�Z�� �I�s�T�z� rr�c��\rSrSrSrSrg)�GatedRepoErrori	a�111Raised when trying to access a gated repository for which the user is not on the112authorized list.113 114Note: derives from `RepositoryNotFoundError` to ensure backward compatibility.115 116Example:117 118```py119>>> from huggingface_hub import model_info120>>> model_info("<gated_repository>")121(...)122huggingface_hub.errors.GatedRepoError: 403 Client Error. (Request ID: ViT1Bf7O_026LGSQuVqfa)123 124Cannot access gated repo for url https://huggingface.co/api/models/ardent-figment/gated-model.125Access to model ardent-figment/gated-model is restricted and you are not in the authorized list.126Visit https://huggingface.co/ardent-figment/gated-model to ask for access.127```128r#Nr$r#rrr�r�	s��rr�c��\rSrSrSrSrg)�DisabledRepoErroria�129Raised when trying to access a repository that has been disabled by its author.130 131Example:132 133```py134>>> from huggingface_hub import dataset_info135>>> dataset_info("laion/laion-art")136(...)137huggingface_hub.errors.DisabledRepoError: 403 Client Error. (Request ID: Root=1-659fc3fa-3031673e0f92c71a2260dbe2;bc6f4dfb-b30a-4862-af0a-5cfe827610d8)138 139Cannot access repository for url https://huggingface.co/api/datasets/laion/laion-art.140Access to this resource is disabled.141```142r#Nr$r#rrr�r����rr�c�B�\rSrSr%SrSr\S-\S'Sr\S-\S'Sr	g)�RevisionNotFoundErrori4a�143Raised when trying to access a hf.co URL with a valid repository but an invalid144revision.145 146Attributes:147    repo_id (`str` or `None`):148        The repo id, if it could be determined from the request URL.149    repo_type (`str` or `None`):150        The repo type ("model", "dataset", or "space"), if it could be determined from the request URL.151 152Example:153 154```py155>>> from huggingface_hub import hf_hub_download156>>> hf_hub_download('bert-base-cased', 'config.json', revision='<non-existent-revision>')157(...)158huggingface_hub.errors.RevisionNotFoundError: 404 Client Error. (Request ID: Mwhe_c3Kt650GcdKEFomX)159 160Revision Not Found for url: https://huggingface.co/bert-base-cased/resolve/%3Cnon-existent-revision%3E/config.json.161```162Nr�r�r#r�r#rrr�r�4�%���,�G�S�4�Z�� �I�s�T�z� rr�c��\rSrSrSrSrg)�EntryNotFoundErroriPa�163Raised when entry not found, either locally or remotely.164 165Example:166 167```py168>>> from huggingface_hub import hf_hub_download169>>> hf_hub_download('bert-base-cased', '<non-existent-file>')170(...)171huggingface_hub.errors.RemoteEntryNotFoundError (...)172>>> hf_hub_download('bert-base-cased', '<non-existent-file>', local_files_only=True)173(...)174huggingface_hub.utils.errors.LocalEntryNotFoundError (...)175```176r#Nr$r#rrr�r�Pr�rr�c�B�\rSrSr%SrSr\S-\S'Sr\S-\S'Sr	g)�RemoteEntryNotFoundErroriba�177Raised when trying to access a hf.co URL with a valid repository and revision178but an invalid filename.179 180Attributes:181    repo_id (`str` or `None`):182        The repo id, if it could be determined from the request URL.183    repo_type (`str` or `None`):184        The repo type ("model", "dataset", or "space"), if it could be determined from the request URL.185 186Example:187 188```py189>>> from huggingface_hub import hf_hub_download190>>> hf_hub_download('bert-base-cased', '<non-existent-file>')191(...)192huggingface_hub.errors.EntryNotFoundError: 404 Client Error. (Request ID: 53pNl6M0MxsnG5Sw8JA6x)193 194Entry Not Found for url: https://huggingface.co/bert-base-cased/resolve/main/%3Cnon-existent-file%3E.195```196Nr�r�r#r�r#rrr�r�br�rr�c�4^�\rSrSrSrS\4U4SjjrSrU=r$)�LocalEntryNotFoundErrori}a197Raised when trying to access a file or snapshot that is not on the disk when network is198disabled or unavailable (connection issue). The entry may exist on the Hub.199 200Example:201 202```py203>>> from huggingface_hub import hf_hub_download204>>> hf_hub_download('bert-base-cased', '<non-cached-file>',  local_files_only=True)205(...)206huggingface_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.207```208r0c�$>�[TU]U5 gr)r
r)rr0rs  �rr� LocalEntryNotFoundError.__init__�s���
����!rr#rvrs@rr�r�}s����"��"�"rr�c��\rSrSrSrSrg)�BadRequestErrori�a'209Raised by `hf_raise_for_status` when the server returns a HTTP 400 error.210 211Example:212 213```py214>>> resp = httpx.post("hf.co/api/check", ...)215>>> hf_raise_for_status(resp, endpoint_name="check")216huggingface_hub.errors.BadRequestError: Bad request for check endpoint: {details} (Request ID: XXX)217```218r#Nr$r#rrr�r��s��219rr�c��\rSrSrSrSrg)�	DDUFErrori�z5Base exception for errors related to the DDUF format.r#Nr$r#rrr�r��s��?rr�c��\rSrSrSrSrg)�DDUFCorruptedFileErrori�z1Exception thrown when the DDUF file is corrupted.r#Nr$r#rrr�r�����;rr�c��\rSrSrSrSrg)�DDUFExportErrori�z-Base exception for errors during DDUF export.r#Nr$r#rrr�r��s��7rr�c��\rSrSrSrSrg)�DDUFInvalidEntryNameErrori�z0Exception thrown when the entry name is invalid.r#Nr$r#rrr�r��r(rr�c��\rSrSrSrSrg)�StrictDataclassErrori�z&Base exception for strict dataclasses.r#Nr$r#rrr�r��s��0rr�c��\rSrSrSrSrg)�StrictDataclassDefinitionErrori�z@Exception thrown when a strict dataclass is defined incorrectly.r#Nr$r#rrr�r��s��Jrr�c�8^�\rSrSrSrS\S\4U4SjjrSrU=r	$)�#StrictDataclassFieldValidationErrori�zLException thrown when a strict dataclass fails validation for a given field.�field�causec�n>�SUS3nUSURRSU3-
n[TU]
U5 g)NzValidation error for field '�':�220    �: �rrr
r)rr�r��
error_messagers    �rr�,StrictDataclassFieldValidationError.__init__�s@���6�u�g�R�@�
��6�%�/�/�":�":�!;�2�e�W�E�E�
�
����'rr#�221rrrrrr�	Exceptionrrrrs@rr�r��s���V�(�c�(�)�(�(rr�c�8^�\rSrSrSrS\S\4U4SjjrSrU=r	$)�#StrictDataclassClassValidationErrori�zOException thrown when a strict dataclass fails validation on a class validator.�	validatorr�c�n>�SUS3nUSURRSU3-
n[TU]
U5 g)Nz&Class validation error for validator 'r�r�r�r�)rr�r�r�rs    �rr�,StrictDataclassClassValidationError.__init__�s@���@���2�N�
��6�%�/�/�":�":�!;�2�e�W�E�E�
�
����'rr#r�rs@rr�r��s���Y�(�#�(�i�(�(rr�c��\rSrSrSrSrg)�XetErrori�z1Base exception for errors related to Xet Storage.r#Nr$r#rrr�r��r�rr�c��\rSrSrSrSrg)�XetAuthorizationErrori�zXException thrown when the user does not have the right authorization to use Xet Storage.r#Nr$r#rrr�r��rzrr�c��\rSrSrSrSrg)�XetRefreshTokenErrori�z3Exception thrown when the refresh token is invalid.r#Nr$r#rrr�r��rZrr�c��\rSrSrSrSrg)�XetDownloadErrori�z:Exception thrown when the download from Xet Storage fails.r#Nr$r#rrr�r��s��Drr�c��\rSrSrSrSrg)�CLIErrori�z7CLI error with clean message (no traceback by default).r#Nr$r#rrr�r��s��Arr�c��\rSrSrSrSrg)�ConfirmationErrori�zERaised when a confirmation prompt is declined (non-interactive mode).r#Nr$r#rrr�r��s��Orr�c��\rSrSrSrSrg)�CLIExtensionInstallErrori�z(Error during CLI extension installation.r#Nr$r#rrr�r��s��2rr�N)9r�pathlibr�httpxrrr�rr!�EnvironmentErrorr&�ConnectionErrorr*�OSErrorr-�TimeoutErrorrHrKrNrQrUrXr\r_rdrgrj�222ValueErrorrmrprxr|rr�r�r�r�r�r��FileNotFoundErrorr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r#rr�<module>r�sS��!��%�#�I�#�R�i�R�;�.�;�_�?�_�;p�Y��;p�BM�I�|�M�C�Y�C�G�$:�L�G��i���y��>�)�>�223(�)�(�	�)�	�	�)�	�	� 3�	�	�&�	��224��#��#�(c�'�c����!�.�!�8!�n�!�<�,��,���*!�N�!�8���$!�~�/A�!�6"�/�1C�"�(�n�j��"@�	�@�<�Y�<�8�i�8�;��;�1�9�1�K�%9�K�(�*>�(�(�*>�(�<�y�<�c�H�c�>�8�>�E�y�E�B�y�B�P��P�3�x�3r
codekingpro/portable-devtools · Team Ai