wL i+ldZddlmZddlmZmZddlmZmZGdde Z Gdde Z Gd d e Z Gd d eZGd deZGddeeZGdde ZGddeeZGdde ZGdde ZGddeZGddeZGddeZGdd eZGd!d"eZGd#d$eZGd%d&eZGd'd(eZ Gd)d*eZ!Gd+d,e!Z"Gd-d.eZ#Gd/d0eZ$Gd1d2eZ%Gd3d4e%e&eZ'Gd5d6eeZ(Gd7d8e Z)Gd9d:e)Z*Gd;de+Z,Gd?d@e Z-GdAdBe-Z.GdCdDe-Z/GdEdFe-Z0GdGdHe Z1GdIdJe1Z2GdKdLe1Z3GdMdNe Z4yO)PzContains all custom errors.)Path)OptionalUnion) HTTPErrorResponsecLeZdZUdZeeefed<dedeeefffd ZxZ S) CacheNotFoundz9Exception thrown when the Huggingface cache is not found. cache_dirmsgc:t||g|i|||_yN)super__init__r )selfr r argskwargs __class__s \/mnt/ssd/data/python-lab/Trading/venv/lib/python3.12/site-packages/huggingface_hub/errors.pyrzCacheNotFound.__init__s! .t.v.") __name__ __module__ __qualname____doc__rstrr__annotations__r __classcell__rs@rr r s6CS$Y#C#E#t),<##rr ceZdZdZy)CorruptedCacheExceptionzGException for any unexpected structure in the Huggingface cache-system.NrrrrrrrrsQrrceZdZdZy)LocalTokenNotFoundErrorz0Raised if local token is required but not found.Nr r!rrr#r#:rr#ceZdZdZy)OfflineModeIsEnabledzTRaised when a request is made but `HF_HUB_OFFLINE=1` is set as environment variable.Nr r!rrr&r&$s^rr&c TeZdZdZd dddedeedeeffdZded dfd ZxZ S) HfHubHTTPErrora@ 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 from "X-Request-Id" header if exists. If not, fallback to "X-Amzn-Trace-Id" header if exists. - Server error message from the header "X-Error-Message". - Server error message if we can found one in the response body. Example: ```py import requests 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_messagemessageresponser)c|8|jjdxs|jjdnd|_||_t|||||j ydy)Nz x-request-idzX-Amzn-Trace-Id)r+request)headersget request_idr)rrr-)rr*r+r)rs rrzHfHubHTTPError.__init__Fs#     0 [H4D4D4H4HIZ4[  -  (0(rrQceZdZdZy)FileMetadataErrorzError triggered when the metadata of a file on the Hub cannot be retrieved (missing ETag or commit_hash). Inherits from `OSError` for backward compatibility. Nr r!rrrSrSr>rrSceZdZdZy)RepositoryNotFoundErrora 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. Example: ```py >>> from huggingface_hub import model_info >>> model_info("") (...) huggingface_hub.utils._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. Invalid username or password. ``` Nr r!rrrUrUsrrUceZdZdZy)GatedRepoErrora 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("") (...) huggingface_hub.utils._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. ``` Nr r!rrrWrWsrrWceZdZdZy)DisabledRepoErrora 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.utils._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. ``` Nr r!rrrYrYrrYceZdZdZy)RevisionNotFoundErrora  Raised when trying to access a hf.co URL with a valid repository but an invalid revision. Example: ```py >>> from huggingface_hub import hf_hub_download >>> hf_hub_download('bert-base-cased', 'config.json', revision='') (...) huggingface_hub.utils._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!rrr\r\rZrr\ceZdZdZy)EntryNotFoundErrora Raised when trying to access a hf.co URL with a valid repository and revision but an invalid filename. Example: ```py >>> from huggingface_hub import hf_hub_download >>> hf_hub_download('bert-base-cased', '') (...) huggingface_hub.utils._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!rrr^r^rZrr^c(eZdZdZdeffd ZxZS)LocalEntryNotFoundErrora 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. Note: `ValueError` type is to ensure backward compatibility. Note: `LocalEntryNotFoundError` derives from `HTTPError` because of `EntryNotFoundError` even when it is not a network issue. Example: ```py >>> from huggingface_hub import hf_hub_download >>> hf_hub_download('bert-base-cased', '', local_files_only=True) (...) huggingface_hub.utils._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. ``` r*c(t||dy)N)r+)rr)rr*rs rrz LocalEntryNotFoundError.__init__&s 40r)rrrrrrrrs@rr`r`s$111rr`ceZdZdZy)BadRequestErroraQ Raised by `hf_raise_for_status` when the server returns a HTTP 400 error. Example: ```py >>> resp = requests.post("hf.co/api/check", ...) >>> hf_raise_for_status(resp, endpoint_name="check") huggingface_hub.utils._errors.BadRequestError: Bad request for check endpoint: {details} (Request ID: XXX) ``` Nr r!rrrcrc+s rrcceZdZdZy) DDUFErrorz5Base exception for errors related to the DDUF format.Nr r!rrrere<s?rreceZdZdZy)DDUFCorruptedFileErrorz1Exception thrown when the DDUF file is corrupted.Nr r!rrrgrg@;rrgceZdZdZy)DDUFExportErrorz-Base exception for errors during DDUF export.Nr r!rrrjrjDs7rrjceZdZdZy)DDUFInvalidEntryNameErrorz0Exception thrown when the entry name is invalid.Nr r!rrrlrlHr$rrlceZdZdZy)StrictDataclassErrorz&Base exception for strict dataclasses.Nr r!rrrnrnOs0rrnceZdZdZy)StrictDataclassDefinitionErrorz@Exception thrown when a strict dataclass is defined incorrectly.Nr r!rrrprpSsJrrpc,eZdZdZdedeffd ZxZS)#StrictDataclassFieldValidationErrorzLException thrown when a strict dataclass fails validation for a given field.fieldcausecnd|d}|d|jjd|z }t| |y)NzValidation error for field '': : rrrr)rrsrt error_messagers rrz,StrictDataclassFieldValidationError.__init__Zs@6ugR@ 6%//":":!;2eWEE  'rrrrrr Exceptionrrrs@rrrrrWsV(c()((rrrc,eZdZdZdedeffd ZxZS)#StrictDataclassClassValidationErrorzOException thrown when a strict dataclass fails validation on a class validator. validatorrtcnd|d}|d|jjd|z }t| |y)Nz&Class validation error for validator 'rvrwrxry)rrrtrzrs rrz,StrictDataclassClassValidationError.__init__cs@@ 2N 6%//":":!;2eWEE  'rr{rs@rr~r~`sY(#(i((rr~ceZdZdZy)XetErrorz1Base exception for errors related to Xet Storage.Nr r!rrrrlrhrrceZdZdZy)XetAuthorizationErrorzXException thrown when the user does not have the right authorization to use Xet Storage.Nr r!rrrrpsbrrceZdZdZy)XetRefreshTokenErrorz3Exception thrown when the refresh token is invalid.Nr r!rrrrtrCrrceZdZdZy)XetDownloadErrorz:Exception thrown when the download from Xet Storage fails.Nr r!rrrrxsDrrN)5rpathlibrtypingrrrequestsrrr|r rEnvironmentErrorr#ConnectionErrorr&r( TimeoutErrorr7r9r;r=r@rBrErGrKrMrO ValueErrorrQOSErrorrSrUrWrYr\r^FileNotFoundErrorr`rcrergrjrlrnrprrr~rrrrr!rrrs!"( #I#RiR;.;_?_.IY.IhMI|MCYCG$:LGiy>)> ()( )  )  3  &  n*,,*N&$102CZ10 nj "@ @((*>(8>EyEr