+
    –°³j¦k  ã                   ó˜  a€ R( t+0 t R t^ RIt^ RIt^ RIHtHt ^ RIHtH	t	H
t
 ^ RIHt ^ RIHtHt ^RIHt ]P$                  P'                  4        U Uu/ uF  w  rWbK	  	  upp t] ^ k ]P*                  ! R4      t]! ]P$                  P1                  4       4      t] ^k ]! 0 R)m4      t] ^k ]! RR	04      t] ^k ]! R
R7       ! R R4      4       t]! R
R7       ! R R4      4       tR R lt]P>                  R*R R ll4       t R R lt!R R lt"R*R R llt#R R lt$R*R R llt%R R lt&R  R! lt'R" R# lt(R$ R% lt)R& R' lt*R# u upp i )+a  Centralized parser for Hugging Face Hub URIs ('hf://...') and mount specifications.

A HF URI is a URI-like string that identifies a location on the Hugging Face
Hub: a model/dataset/space/kernel repository, a bucket, optionally a revision,
and optionally a path inside the repo or bucket.

Canonical syntax:

```
hf://[<TYPE>/]<ID>[@<REVISION>][/<PATH>]
```

For convenience, [`parse_hf_uri`] also accepts Hugging Face **web URLs** (the
ones you copy-paste from your browser), e.g.
'https://huggingface.co/datasets/my-org/my-dataset/blob/main/train.csv'. They are
normalized to the canonical 'hf://' form before parsing. Only unambiguous URLs
(repository / bucket pages and file/folder viewer routes) are accepted; any other
route is rejected rather than guessed.

A HF mount wraps a HF URI with a local mount path and an optional ':ro'/':rw'
flag (used by Spaces and Jobs volumes):

```
hf://[<TYPE>/]<ID>[@<REVISION>][/<PATH>]:<MOUNT_PATH>[:ro|:rw]
```

See 'docs/source/en/package_reference/hf_uris.md' for the full grammar and examples.
N)Ú	dataclassÚfield)ÚquoteÚunquoteÚurlsplit)Ú	constants)Ú
HfUriErrorÚHFValidationError)Úvalidate_repo_idz ^refs/(?:convert/[\w.-]+|pr/\d+)ÚresolveÚtreeT)Úfrozenc                   óÂ   a € ] tR t^Nt o RtRtRt]! RRRRR7      tV 3R lR lt	]
V 3R lR	 l4       t]
V 3R
 lR l4       tV 3R lR ltRV 3R lR lltV 3R ltRtV tR# )ÚHfUria½  Parsed representation of a Hugging Face Hub URI ('hf://...').

Attributes:
    type (`str`):
        One of 'model', 'dataset', 'space', 'kernel' or 'bucket'.
    id (`str`):
        The repository id ('namespace/name', e.g. 'my-org/my-model') for repo URIs, or the bucket id ('namespace/name') for bucket URIs.
    revision (`str`, *optional*):
        The revision specified after '@' in the URI, URL-decoded. 'None' if no revision was specified, or for bucket URIs (which
        never carry a revision). Special refs like 'refs/pr/10' and 'refs/convert/parquet' are preserved as-is.
    path_in_repo (`str`):
        The path inside the repo or bucket. Empty string if the URI points at the root.
NÚ F©ÚreprÚhashÚcompareÚdefaultc                ó   <€ V ^8„  d   QhRR/# ©é   ÚreturnN© )ÚformatÚ__classdict__s   "€Ú_/home/luca/screen-checking/.venv/lib/python3.14/site-packages/huggingface_hub/utils/_hf_uris.pyÚ__annotate__ÚHfUri.__annotate__d   s   ø€ ÷ tñ t˜tñ tó    c           	     ób  € V P                   ;'       g    R pV P                  \        9  d,   \        VRV P                   R\	        \        4       R2R7      hV P
                  '       d!   V P
                  P                  R4      ^8w  d   \        VRV P
                   R2R7      hV P                  R8w  d    \        V P
                  4       V P                  e    V P                  '       g   \        VR
R7      hV P                  R8X  d   V P                  e   \        VRR7      hV P                  '       dP   V P                  P                  R4      '       g   RV P                  9   d   \        VRV P                   R2R7      hR	# R	#   \         d   p\        T\        T4      R7      ThR	p?ii ; i)r   zInvalid type 'z'. Must be one of Ú.©ÚuriÚmsgÚ/z"Id must be 'namespace/name', got 'ú'.ÚbucketNz%Revision must not be an empty string.z&Bucket URIs do not support a revision.ú//z+Path must not contain empty segments (got 'z').)Ú_rawÚtypeÚ_VALID_URI_TYPESr   ÚsortedÚidÚcountr
   r	   ÚstrÚrevisionÚpath_in_repoÚ
startswith)Úselfr$   Úes   &  r   Ú__post_init__ÚHfUri.__post_init__d   si  € Ø�i‰i�oˆo˜2ˆð �9‰9Ô,Ô,Ü ¨N¸4¿9¹9¸+ÐEWÔX^Ô_oÓXpÐWqÐqrÐ*sÔtÐtð �w�wˆw˜$Ÿ'™'Ÿ-™-¨Ó,°Ô1Ü Ð,NÈtÏwÉwÈiÐWYÐ*ZÔ[Ð[Ø�9‰9˜Ô ð=Ü  §¡Ô)ð
 �=‰=Ò$¨T¯]¯]¨]Ü Ð*QÔRÐRØ�9‰9˜Ô  T§]¡]Ò%>Ü Ð*RÔSÐSð ××ÐØ× Ñ ×+Ñ+¨C×0Ò0°D¸D×<MÑ<MÔ4MÜ  SÐ0[Ð\`×\mÑ\mÐ[nÐnqÐ.rÔsÐsñ 5Nñ øô %ô =Ü  S¬c°!«fÔ5¸1Ð<ûð=ús   Â6F ÆF.ÆF)Æ)F.c                ó    <€ V ^8„  d   QhRS[ /# ©r   r   ©Úbool)r   r   s   "€r   r   r   €   s   ø€ ÷ %ñ %™4ñ %r    c                ó    € V P                   R8H  # )z$True if this URI points at a bucket.r(   ©r+   ©r4   s   &r   Ú	is_bucketÚHfUri.is_bucket   ó   € ð �y‰y˜HÑ$Ð$r    c                ó    <€ V ^8„  d   QhRS[ /# r9   r:   )r   r   s   "€r   r   r   …   s   ø€ ÷ %ñ %™ñ %r    c                ó    € V P                   R8g  # )zJTrue if this URI points at a repository (model, dataset, space or kernel).r(   r=   r>   s   &r   Úis_repoÚHfUri.is_repo„   rA   r    c                ó    <€ V ^8„  d   QhRS[ /# r9   ©r0   )r   r   s   "€r   r   r   ‰   s   ø€ ÷ ñ ™ñ r    c                ó¦  € \         P                  \        V P                  ,          RV P                  .pV P
                  eQ   V P
                  pRV9   d*   \        P                  V4      f   VP                  RR4      pVP                  RV 24       V P                  '       d   VP                  RV P                   24       RP                  V4      # )z‚Render the URI as a canonical 'hf://' string.

The type prefix is always written explicitly (e.g. 'hf://models/my-org/my-model').
r&   ú%2FÚ@r   )r   ÚHF_PROTOCOLÚ_TYPE_TO_PREFIXr+   r.   r1   Ú_SPECIAL_REFS_REVISION_REGEXÚ	fullmatchÚreplaceÚappendr2   Újoin)r4   Úpartsr1   s   &  r   Úto_uriÚHfUri.to_uri‰   s­   € ô
 &×1Ñ1´?À4Ç9Á9Õ3MÈsÐTX×T[ÑT[Ð\ˆØ�=‰=Ò$ð —}‘}ˆHØ�hŒÔ#?×#IÑ#IÈ(Ó#SÒ#[Ø#×+Ñ+¨C°Ó7�Ø�L‰L˜1˜X˜J˜Ô(Ø××ÐØ�L‰L˜1˜T×.Ñ.Ð/Ð0Ô1Ø�w‰w�u‹~Ðr    c                ó4   <€ V ^8„  d   QhRS[ R,          RS[ /# ©r   ÚendpointNr   rG   )r   r   s   "€r   r   r   ›   s   ø€ ÷ 0ñ 0™s T�zð 0±Sñ 0r    c                óv  € T;'       g    \         P                  P                  R4      p\        V P                  RR7      pV P
                  R8X  d(   V RV P                   2pV'       d   VRV 2,          pV# V P
                  R8X  d   V RV P                   2M(V R\        V P
                  ,           RV P                   2pV P                  pVe%   \        P                  V4      f   \        VRR7      pV'       d*   TRT;'       g    \         P                   RV 2,          pV# Ve   VRV 2,          pV# )	ay  Render the URI as a Hugging Face **web URL** (the kind you open in a browser).

This is the inverse of parsing a URL with [`parse_hf_uri`]. The returned URL points at:

- the repository / bucket landing page when no path or revision is set;
- the folder viewer ('/tree/<revision>') when only a revision is set;
- the file viewer ('/blob/<revision>/<path>') for repository files (revision defaults to 'main');
- the tree route ('/tree/<path>') for bucket files (buckets are not versioned).

Args:
    endpoint (`str`, *optional*):
        Base endpoint to use. Defaults to 'constants.ENDPOINT' (i.e. 'https://huggingface.co').

Returns:
    `str`: the web URL.

Example:
    ```py
    >>> from huggingface_hub import parse_hf_uri
    >>> parse_hf_uri("hf://datasets/my-org/my-dataset@v1/train.csv").to_url()
    'https://huggingface.co/datasets/my-org/my-dataset/blob/v1/train.csv'
    ```
r&   )Úsafer(   z	/buckets/z/tree/Úmodelr   z/blob/)r   ÚENDPOINTÚrstripr   r2   r+   r.   rL   r1   rM   rN   ÚDEFAULT_REVISION)r4   rW   ÚbaseÚpathÚurlr1   s   &&    r   Úto_urlÚHfUri.to_url›   s4  € ð0 ×.Ð.œI×.Ñ.×6Ñ6°sÓ;ˆô �T×&Ñ&¨SÔ1ˆà�9‰9˜Ô Ø�F˜) D§G¡G 9Ð-ˆCßØ˜ ˜v�Õ&�ØˆJð &*§Y¡Y°'Ô%9���a˜Ÿ™�yÑ!À$ÀÀqÌÐY]×YbÑYbÕIcÐHdÐdeÐfj×fmÑfmÐenÐ?oˆØ—=‘=ˆð
 ÒÔ$@×$JÑ$JÈ8Ó$TÒ$\Ü˜X¨BÔ/ˆHßØ�V˜H×BÐB¬	×(BÑ(BÐCÀ1ÀTÀFÐKÕKˆCð ˆ
ð Ò!Ø�V˜H˜:Ð&Õ&ˆCØˆ
r    c                ó†   <€ V ^8„  d   Qh/ S[ P                  ;R&   S[;R&   S[R,          ;R&   S[;R&   S[R,          ;R&   # )r   r+   r.   Nr1   r2   r*   )r   Ú	HfUriTyper0   )r   r   s   "€r   r   r   N   sS   ø‡ ‚ ñ  ×
Ñ
Ññ! ñ" 	�Gñ# ñ$ �D�jÑñ% ñ& Ññ' ñ( ��*ÑQò) r    r   ©N)Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__r1   r2   r   r*   r6   Úpropertyr?   rD   rS   ra   Ú__annotate_func__Ú__static_attributes__Ú__classdictcell__©r   s   @r   r   r   N   sv   ø‡ € ñð   €HØ€LÙ %¨e¸UÈDÔQ€D÷tð tð6 ÷%ó ð%ð ÷%ó ð%÷ð ÷$0ò 0÷[ ƒ r    r   c                   óp   a € ] tR t^Ît o RtRt]! RRRRR7      tV 3R lR ltV 3R lR lt	V 3R	 lt
R
tV tR# )ÚHfMounta  A HF URI paired with a local mount path and optional read-only flag.

Used by Spaces and Jobs to describe volume mounts. The full syntax is:

```
hf://[<TYPE>/]<ID>[@<REVISION>][/<PATH>]:<MOUNT_PATH>[:ro|:rw]
```

Attributes:
    source ([`HfUri`]):
        The parsed HF URI identifying the Hub resource to mount.
    mount_path (`str`):
        The local mount path (always starts with '/').
    read_only (`bool`, *optional*):
        True if the mount ends with ':ro', False if it ends with ':rw', 'None' if no flag was provided.
NFr   c                ó   <€ V ^8„  d   QhRR/# r   r   )r   r   s   "€r   r   ÚHfMount.__annotate__æ   s   ø€ ÷ ñ ˜tñ r    c                óÌ   € V P                   ;'       g    R pV P                  P                  R4      '       d   V P                  R8X  d   \        VRV P                   R2R7      hR# )r   r&   zEMount path must be a non-empty absolute path starting with '/', got 'r'   r#   N)r*   Ú
mount_pathr3   r   )r4   Úraws   & r   r6   ÚHfMount.__post_init__æ   s\   € Ø�i‰i�oˆo˜2ˆØ�‰×)Ñ)¨#×.Ò.°$·/±/ÀSÔ2HÜØØ[Ð\`×\kÑ\kÐ[lÐlnÐoôð ñ 3Ir    c                ó    <€ V ^8„  d   QhRS[ /# r9   rG   )r   r   s   "€r   r   rs   î   s   ø€ ÷ ñ ™ñ r    c                óØ   € V P                   P                  4       RV P                  .pV P                  e&   TP	                  V P                  '       d   RMR4       RP                  V4      # )zaRender the mount as a canonical 'hf://' string.

Example: 'hf://models/my-org/my-model:/data:ro'
Ú:ú:roú:rwr   )ÚsourcerS   ru   Ú	read_onlyrP   rQ   )r4   rR   s   & r   rS   ÚHfMount.to_uriî   sO   € ð
 —‘×#Ñ#Ó% s¨D¯O©OÐ<ˆØ�>‰>Ò%Ø�L‰L $§.§. .™°eÔ<Ø�w‰w�u‹~Ðr    c                óf   <€ V ^8„  d   Qh/ S[ ;R&   S[;R&   S[R,          ;R&   S[R,          ;R&   # )r   r}   ru   Nr~   r*   )r   r0   r;   )r   r   s   "€r   r   rs   Î   s?   ø‡ ‚ ñ& �Mñ' ñ( �Oñ) ñ* �d�{Ñ!ñ+ ñ, ��*ÑQò- r    r   )rf   rg   rh   ri   rj   r~   r   r*   r6   rS   rl   rm   rn   ro   s   @r   rq   rq   Î   s=   ø‡ € ñð& "€IÙ %¨e¸UÈDÔQ€D÷ð ÷ð ÷A ƒ r    rq   c                ó0   € V ^8„  d   QhR\         R\        /# )r   r$   r   ©r0   r;   )r   s   "r   r   r   ù   s   € ÷ ñ ”3ð œ4ñ r    c                óB   €  \        V 4       R#   \         d     R# i ; i)zVCheck if a string is a valid HF URI ('hf://...') or a recognized Hugging Face web URL.TF)Úparse_hf_urir   )r$   s   &r   Ú	is_hf_urir…   ù   s$   € ðÜ�SÔÙøÜô Úðús   ‚ ��c                óJ   € V ^8„  d   QhR\         R\         R,          R\        /# ©r   r$   rW   Nr   )r0   r   )r   s   "r   r   r     s%   € ÷ <6ñ <6”cð <6¤S¨4¥Zð <6¼5ñ <6r    c                óÐ  € T pV P                  \        P                  4      '       dD   V \        \        P                  4      R pV'       g   \	        V R\        P                   R24      hMN\        WR7      '       d   \        WR7      pM/\	        V R\        P                   R\        P                   R24      h\        W2R7      w  rEVR	8X  d   \        WTVR7      # \        WTVR7      # )
a7  Parse a Hugging Face Hub URI ('hf://...') or a Hugging Face web URL.

A HF URI is a URI-like string identifying a location on the Hugging Face Hub. The full grammar is:

```
hf://[<TYPE>/]<ID>[@<REVISION>][/<PATH>]
```

For convenience, Hugging Face **web URLs** (the ones you copy-paste from the website) are also
accepted and normalized to the canonical 'hf://' form, e.g.
'https://huggingface.co/datasets/my-org/my-dataset/blob/main/train.csv'. Only unambiguous URLs
(repository / bucket pages and file/folder viewer routes) are accepted; any other route is rejected.

See 'docs/source/en/package_reference/hf_uris.md' for the full specification.

Args:
    uri (`str`):
        The URI to parse. Must start with 'hf://', or be a Hugging Face URL (e.g. 'https://huggingface.co/...').
    endpoint (`str`, *optional*):
        A custom Hub endpoint (e.g. a self-hosted or proxied Hub like 'https://hub.my-company.com' or
        'http://localhost:8080/hf'). When provided, web URLs on that endpoint are recognized in addition to
        the default Hugging Face hosts. Has no effect on 'hf://' URIs.

Returns:
    [`HfUri`]: the parsed URI.

Raises:
    [`HfUriError`]:
        If the URI is malformed (missing prefix, invalid type, missing id, unsupported URL route, etc.).

Examples:
    ```py
    >>> from huggingface_hub.utils import parse_hf_uri
    >>> parse_hf_uri("hf://my-org/my-model")
    HfUri(type='model', id='my-org/my-model', revision=None, path_in_repo='')
    >>> parse_hf_uri("hf://datasets/my-org/my-dataset@refs/pr/3/train.json")
    HfUri(type='dataset', id='my-org/my-dataset', revision='refs/pr/3', path_in_repo='train.json')
    >>> parse_hf_uri("https://huggingface.co/datasets/my-org/my-dataset/blob/main/train.csv")
    HfUri(type='dataset', id='my-org/my-dataset', revision='main', path_in_repo='train.csv')
    ```
NúEmpty body after 'r'   )rW   úMust start with 'zQ' or be a Hugging Face URL (e.g. 'https://huggingface.co/...'). Expected format: z#[<TYPE>/]<ID>[@<REVISION>][/<PATH>]©rv   r(   )
r3   r   rK   Úlenr   Ú_looks_like_hf_urlÚ_url_to_uri_bodyÚ_split_typeÚ_parse_bucket_bodyÚ_parse_repo_body)r$   rW   rv   ÚbodyÚtype_Úlocations   &&    r   r„   r„     sÚ   € ðV €CØ
‡~�~”i×+Ñ+×,Ò,Ø”3”y×,Ñ,Ó-Ð/Ð0ˆßÜ˜SÐ$6´y×7LÑ7LÐ6MÈRÐ"PÓQÐQð ä	˜C×	3Ó	3Ü Ô7‰äØØ¤	× 5Ñ 5Ð6ð 7 Ü )× 5Ñ 5Ð6Ð6Yð[ó
ð 	
ô " $Ô0�O€Eà�ÔÜ! (°sÔ;Ð;Ü˜H°Ô5Ð5r    c                ón   € V ^8„  d   QhR\         R,          R\        \         R,          \         3,          /# rV   )r0   Útuple)r   s   "r   r   r   B  s+   € ÷ (ñ (¤c¨D¥jð (´U¼3À½:Äs¸?Õ5Kñ (r    c                óØ   € V f   R# \        RV 9   d   T MRV ,           4      pVP                  '       d   VP                  P                  4       MRpW!P                  P	                  R4      3# )a  Return the lowercased host and stripped path prefix of a custom Hub 'endpoint'.

E.g. 'https://hub.my-company.com' -> ('hub.my-company.com', '') and a self-hosted
'http://localhost:8080/hf' -> ('localhost', 'hf'). Returns '(None, "")' when 'endpoint' is None.
Nú://r)   r&   )Nr   )r   ÚhostnameÚlowerr_   Ústrip)rW   ÚparsedÚhosts   &  r   Ú_endpoint_host_and_pathrž   B  sZ   € ð ÒØˆä %¨8Ô"3‘h¸À½ÓI€FØ&,§o§o oˆ6�?‰?× Ñ Ô"¸4€DØ—‘×"Ñ" 3Ó'Ð'Ð'r    c                óT   € V ^8„  d   QhR\         R,          R\        \         ,          /# rV   )r0   Ú	frozenset)r   s   "r   r   r   P  s&   € ÷ Oñ O¤ d¥
ð O¬y¼­~ñ Or    c                ó|   € \        V 4      w  rV'       d   \        P                  V0,          # \        P                  # )z^The set of hosts whose web URLs can be parsed: the default Hugging Face hosts plus 'endpoint'.)rž   r   ÚHF_URL_HOSTS)rW   r�   Ú_s   &  r   Ú_recognized_hostsr¤   P  s.   € ä% hÓ/�G€Dß.2Œ9×!Ñ! T FÕ*ÐN¼	×8NÑ8NÐNr    c                óJ   € V ^8„  d   QhR\         R\         R,          R\        /# r‡   r‚   )r   s   "r   r   r   V  s*   € ÷ jñ jœCð j¬3°­:ð jÄñ jr    c                óî   a€ V P                  4       oSP                  R4      '       d   R# \        ;QJ d(    V3R l\        V4       4       F  '       g   K   R# 	  R# ! V3R l\        V4       4       4      # )zNReturn True if 'uri' looks like a (possibly scheme-less) Hugging Face web URL.Tc              3   ón   <"  € T F*  pSV8H  ;'       g    SP                  VR ,           4      x € K,  	  R# 5i)r&   N)r3   )Ú.0r�   Úlowereds   & €r   Ú	<genexpr>Ú%_looks_like_hf_url.<locals>.<genexpr>\  s1   øé € ÐiÑMhÀTˆw˜$‰×@Ð@ '×"4Ñ"4°T¸CµZÓ"@Ô@ÓMhùs   ƒ5”!5F)zhttp://zhttps://)rš   r3   Úanyr¤   )r$   rW   r©   s   &&@r   r�   r�   V  sZ   ø€ à�i‰i‹k€GØ×ÑÐ1×2Ò2Ùç‹3ÔiÔM^Ð_gÔMhÓi�3Œ3ÐiŠ3Ðiˆ3ÔiÔM^Ð_gÔMhÓiÓiÐir    c                ó0   € V ^8„  d   QhR\         R\         /# )r   Úsegmentr   rG   )r   s   "r   r   r   _  s   € ÷ 0ñ 0¤cð 0¬cñ 0r    c                ó8   € \        V 4      P                  RR4      # )ag  Percent-decode a single URL path segment (e.g. 'file%20name.txt' -> 'file name.txt').

A decoded '/' is re-encoded as '%2F' so the segment stays atomic when the normalized body is
re-split by the shared parser. This decodes ordinary path characters (spaces, '#', ...) that
browsers encode, while keeping '%2F'-encoded revisions (e.g. 'feature%2Ffoo') intact.
r&   rI   )r   rO   )r®   s   &r   Ú_decode_url_path_segmentr°   _  s   € ô �7Ó×#Ñ# C¨Ó/Ð/r    c                óJ   € V ^8„  d   QhR\         R\         R,          R\         /# )r   r`   rW   Nr   rG   )r   s   "r   r   r   i  s*   € ÷ O*ñ O*œ#ð O*¬¨t­ð O*¼sñ O*r    c                ó¬  € T p\        RV 9   d   T MRV ,           4      pVP                  ;'       g    RP                  4       pV\        V4      9  d   \	        TRT;'       g    T  R2R7      hVP
                  p\        V4      w  rgV'       dB   WF8X  d<   RV,           pWX8X  g   VP                  VR,           4      '       d   V\        V4      R pVP                  R4       U	u. uF  q™'       g   K  V	NK  	  p
p	V
'       g   \	        VR	V  R
2R7      hRpV
^ ,          \        P                  9   d   V
^ ,          pV
R,          p
\        V
4      ^8  d   \	        VRV  R2R7      hV
^ ,           RV
^,           2pV
R,          pVR8X  d]   V'       g   RV 2# VvrïV\        9  d   \	        VRV  RV R2R7      hRP                  R V 4       4      pV'       d	   RV RV 2# RV 2# V'       d   V R2MRpV'       g   V V 2# VvrïV\        9  d   \	        VRV  RV R2R7      hV'       g   V V 2# RP                  R V 4       4      pV V RV 2# u up	i )aÎ  Normalize a Hugging Face web URL into the body of a 'hf://' URI (everything after 'hf://').

The returned string is fed back into the regular URI parsing logic, so all validation
(repo id, revision, empty path segments, ...) is shared with the canonical 'hf://' path.
Only unambiguous URLs are accepted: any unrecognized route raises [`HfUriError`]. When 'endpoint'
is provided, URLs on that custom Hub host are recognized too (and its path prefix is stripped).
r˜   r)   r   zUnrecognized host 'zC'. Expected a Hugging Face URL (e.g. 'https://huggingface.co/...').r#   r&   Nz0Missing repository or bucket identifier in URL 'r'   :é   NNzCannot parse URL 'z{': expected a '<namespace>/<name>' repository or bucket. User/organization pages and single-segment URLs are not supported.:r   NNÚbucketszbuckets/zCannot parse bucket URL 'z': unsupported '/z	/' route.c              3   ó8   "  € T F  p\        V4      x € K  	  R # 5ire   ©r°   ©r¨   r®   s   & r   rª   Ú#_url_to_uri_body.<locals>.<genexpr>¡  s   é € ÐNÉ¸gÔ0°×9Ð9Ëùó   ‚zl/' route. Only repository pages and file/folder viewer routes (blob, resolve, raw, tree, ...) can be parsed.c              3   ó8   "  € T F  p\        V4      x € K  	  R # 5ire   r¶   r·   s   & r   rª   r¸   ·  s   é € ÐMÉ¸WÔ/°×8Ð8Ëùr¹   rJ   )r   r™   rš   r¤   r   r_   rž   r3   rŒ   Úsplitr   ÚHF_URI_TYPE_PREFIXESÚ_URL_BUCKET_LOCATION_ACTIONSrQ   Ú_URL_REPO_LOCATION_ACTIONS)r`   rW   rv   rœ   r�   r_   Úendpoint_hostÚendpoint_pathÚprefixr®   ÚsegmentsÚtype_prefixÚrepo_idÚrestÚactionÚtailÚdecodeds   &&               r   rŽ   rŽ   i  sš  € ð €Cä˜U cœ\‘c¨t°c­zÓ:€FØ�O‰O×!Ð!˜r×(Ñ(Ó*€DØÔ$ XÓ.Ô.ÜØØ% d§k k¨c ]Ð2uÐvô
ð 	
ð �;‰;€Dô $;¸8Ó#DÑ €Mß˜Ô.Ø�}Õ$ˆØŒ>˜TŸ_™_¨V°c­\×:Ò:Øœ˜F›˜Ð&ˆDØ'+§z¡z°#¤ÓB¡˜G»'—�¡€HÐBßÜ˜SÐ(XÐY\ÐX]Ð]_Ð&`ÔaÐað #€KØ�…{”i×4Ñ4Ô4Ø˜q•kˆØ˜B•<ˆô ˆ8ƒ}�qÔÜØà$ S Eð *Uð Uô
ð 	
ð ˜!•�˜Q˜x¨�{˜mÐ,€GØ�B�<€Dà�iÔßØ˜g˜YÐ'Ð'ØˆˆØÔ5Ô5Ü Ð,EÀcÀUÐJ[Ð\bÐ[cÐclÐ*mÔnÐnØ�x‰xÑNÉÓNÓNˆß.2�˜'˜ ! D 6Ð*ÐL¸(À7À)Ð8LÐLç"-�ˆ}˜AÑ°2€FßØ�˜'˜Ð#Ð#Ø€M€FØÔ/Ô/ÜØà$ S EÐ):¸6¸(ð Cuð uô
ð 	
÷ à�˜'˜Ð#Ð#ð
 �h‰hÑMÉÓMÓM€GØˆX�g�Y˜a ˜yÐ)Ð)ùòi Cs   Ã"	IÃ0Ic                ó0   € V ^8„  d   QhR\         R\        /# )r   Ú	mount_strr   )r0   rq   )r   s   "r   r   r   »  s   € ÷ 7Xñ 7Xœcð 7X¤gñ 7Xr    c                ó  € V P                  \        P                  4      '       g    \        V R\        P                   R2R7      hT pV \	        \        P                  4      R pV'       g    \        VR\        P                   R2R7      h\        W!R7      w  r4pVf   \        VRR7      h\        P                  V,           p \        V4      p\        YtYQR7      #   \         d   p\        YP                  R7      ThRp?ii ; i)	a[  Parse a HF mount specification ('hf://...:<MOUNT_PATH>[:ro|:rw]').

A mount specification is a HF URI followed by a local mount path and an optional read-only/read-write flag.
The full grammar is:

```
hf://[<TYPE>/]<ID>[@<REVISION>][/<PATH>]:<MOUNT_PATH>[:ro|:rw]
```

See 'docs/source/en/package_reference/hf_uris.md' for the full specification.

Args:
    mount_str (`str`):
        The mount string to parse. Must start with 'hf://' and contain a ':<MOUNT_PATH>' segment.

Returns:
    [`HfMount`]: the parsed mount.

Raises:
    [`HfUriError`]:
        If the mount string is malformed (missing mount path, invalid URI, etc.).

Examples:
    ```py
    >>> from huggingface_hub.utils import parse_hf_mount
    >>> parse_hf_mount("hf://my-org/my-model:/data:ro")
    HfMount(source=HfUri(type='model', id='my-org/my-model', revision=None, path_in_repo=''), mount_path='/data', read_only=True)
    >>> parse_hf_mount("hf://buckets/my-org/my-bucket/sub/dir:/mnt:rw")
    HfMount(source=HfUri(type='bucket', id='my-org/my-bucket', revision=None, path_in_repo='sub/dir'), mount_path='/mnt', read_only=False)
    ```
rŠ   r'   r#   Nr‰   r‹   zKMissing mount path. Expected ':<MOUNT_PATH>' (e.g. 'hf://org/model:/data').)r}   ru   r~   r*   )	r3   r   rK   r   rŒ   Ú_split_mountr„   r%   rq   )	rÊ   rv   r’   r”   ru   r~   Úuri_strr}   r5   s	   &        r   Úparse_hf_mountrÎ   »  sö   € ð@ ×Ñ¤	× 5Ñ 5×6Ò6ÜØØ#¤I×$9Ñ$9Ð#:¸"Ð=ô
ð 	
ð
 €CØ”Sœ×.Ñ.Ó/Ð1Ð2€DßÜ˜SÐ(:¼9×;PÑ;PÐ:QÐQSÐ&TÔUÐUä&2°4Ô&AÑ#€H˜)àÒÜ˜SÐ&sÔtÐtô ×#Ñ# hÕ.€Gð4Ü˜gÓ&ˆô ˜&À9ÔWÐWøô ô 4Ü˜S§e¡eÔ,°!Ð3ûð4ús   ÃC ÃDÃ%C<Ã<Dc          
      ó„   € V ^8„  d   QhR\         R\         R\        \         \         R,          \        R,          3,          /# )r   r’   rv   r   N)r0   r–   r;   )r   s   "r   r   r   õ  s5   € ÷ +ñ +”sð +¤Cð +¬E´#´s¸TµzÄ4È$Å;Ð2NÕ,Oñ +r    c               ó\  € V P                  R4      '       d   RV P                  R4      rM,V P                  R4      '       d   RV P                  R4      rMRpV P                  R4      pVR
8X  d   Ve   \        VRR7      hV RR3# V RV pW^,           R pV'       g   \        VR	R7      hWEV3# )z¡Split the ':<MOUNT_PATH>[:ro|:rw]' suffix from 'body'.

Returns '(location, mount_path, read_only)' where 'mount_path' is 'None' if no mount segment is present.
r{   Tr|   FNz:/zb':ro'/':rw' suffix is only valid when a mount path is provided (e.g. 'hf://...:/<MOUNT_PATH>:ro').r#   z#Missing location before mount path.éÿÿÿÿ)ÚendswithÚremovesuffixÚrfindr   )r’   rv   r~   Úidxr”   ru   s   &$    r   rÌ   rÌ   õ  s¾   € ð
 ‡}�}�U×ÒØ × 1Ñ 1°%Ó 8‘4Ø	�‰�u×	Ò	Ø ×!2Ñ!2°5Ó!9‘4àˆ	ð �*‰*�TÓ
€CØ
ˆb„yØÒ ÜØØxôð ð �T˜4ÐÐà�D�Sˆz€HØ˜A•g�i�€JßÜ˜SÐ&KÔLÐLØ Ð*Ð*r    c                ór   € V ^8„  d   QhR\         R\         R\        \        P                  \         3,          /# )r   r”   rv   r   )r0   r–   r   rd   )r   s   "r   r   r     s1   € ÷ ñ œ#ð ¤sð ¬u´Y×5HÑ5HÌ#Ð5MÕ/Nñ r    c          	     óþ  € V P                  R4      pVR8X  dx   V \        P                  9   d%   \        VRV  R\        P                   V  R2R7      h\
        P                  V 4      ;pe"   \        VR\        P                   V R2R7      hR	V 3# V RV pW^,           R pV\        P                  9   d   \        P                  V,          V3# \
        P                  V4      ;pe   \        VR
V RV R2R7      hR	V 3# )zÑDetect the (optional) type prefix and return '(type, remaining_location)'.

A missing type prefix defaults to 'model'. Singular forms ('model/', 'dataset/', etc.) are explicitly rejected with a helpful error.
r&   zMissing identifier after 'z'. Expected 'z/<ID>'.r#   Nz*Type prefix must be plural. Did you mean 'z/...'?rZ   z!Type prefix must be plural, got 'z/'. Did you mean 'z/'?rÑ   )Úfindr   r¼   r   rK   rL   Úget)r”   rv   Ú	slash_idxÚsingular_pluralÚfirstrÅ   s   &$    r   r�   r�     s-  € ð
 —‘˜cÓ"€IØ�B„à”y×5Ñ5Ô5ÜØØ0°°
¸-Ì	×H]ÑH]ÐG^Ð_gÐ^hÐhoÐpôð ô  /×2Ñ2°8Ó<Ð<ˆOÒIÜØØ@Ä×AVÑAVÐ@WÐXgÐWhÐhnÐoôð ð ˜Ð Ð à�Z�iÐ €EØ •M�OÐ$€DØ”	×.Ñ.Ô.Ü×-Ñ-¨eÕ4°dÐ:Ð:Ü*×.Ñ.¨uÓ5Ð5ˆÒBÜØÐ<¸U¸GÐCUÐVeÐUfÐfiÐjô
ð 	
ð �HÐÐr    c                ó\   € V ^8„  d   QhR\         R\        P                  R\         R\        /# ©r   r”   r“   rv   r   ©r0   r   rd   r   )r   s   "r   r   r   2  s6   € ÷ ñ Üðä×Ñðô 
ð	ô
 ñr    c               ón  € V P                  R4      p V P                  R^4      p\        V4      ^8  g   V^ ,          '       d   V^,          '       g   \        VRV  R2R7      hV^ ,           RV^,           2pRV9   d   \        VRR7      h\        V4      ^8¼  d
   V^,          MRp\	        VVRVVR	7      # )
z8Parse the body of a bucket URI: 'namespace/name[/path]'.r&   z)Bucket id must be 'namespace/name', got 'r'   r#   rJ   z3Bucket URIs do not support a revision marker ('@').r   N©r+   r.   r1   r2   r*   )r›   r»   rŒ   r   r   )r”   r“   rv   rR   Ú	bucket_idÚpath_in_buckets   &&$   r   r�   r�   2  s¶   € ð �~‰~˜cÓ"€HØ�N‰N˜3 Ó"€EÜ
ˆ5ƒz�A„~˜U 1ŸXœX¨U°1¯X¬XÜ˜SÐ(QÐRZÐQ[Ð[]Ð&^Ô_Ð_Ø˜•8�*˜A˜e A�h˜ZÐ(€IØ
ˆiÔÜ˜SÐ&[Ô\Ð\Ü!$ U£¨q¤�U˜1–X°b€NÜØØØØ#Øôð r    c                ó\   € V ^8„  d   QhR\         R\        P                  R\         R\        /# rÞ   rß   )r   s   "r   r   r   J  s6   € ÷ 8ñ 8Üð8ä×Ñð8ô 
ð	8ô
 ñ8r    c               ó\  € V P                  R4      p V '       g   \        VRR7      hV P                  R4      pVR8X  g   V RV P                  R4      ^8”  dg   RpV P	                  R^4      p\        V4      ^8  d   \        VRV  R2R7      hV^ ,           RV^,           2p\        V4      ^8”  d
   V^,          MRpMàV RV pW^,           R pV'       g   \        VR	R7      hVP                  R4      ^8w  d   \        VRV R
2R7      h\        P                  V4      p	V	e/   V	P                  4       pV\        V4      R P                  R4      pM-VP                  R4      p
V
R8X  d   TpRpMVRV
 pWŠ^,           R p\        V4      pV'       g   \        VRR7      h\        VVVVVR7      # )z@Parse the body of a repo URI: '<repo_id>[@<revision>][/<path>]'.r&   zMissing repository id.r#   rJ   Nz-Repository id must be 'namespace/name', got 'z'. r   z!Missing repository id before '@'.r'   zEmpty revision after '@'.rá   rÑ   )r›   r   rØ   r/   r»   rŒ   rM   ÚmatchÚgroupÚremoveprefixr   r   )r”   r“   rv   Úat_idxr1   rR   rÄ   r2   Úrev_and_pathræ   rÚ   s   &&$        r   r‘   r‘   J  sÂ  € ð �~‰~˜cÓ"€HßÜ˜SÐ&>Ô?Ð?ð
 �]‰]˜3Ó€Fð �„|�x  Ð(×.Ñ.¨sÓ3°aÔ7àˆØ—‘˜s AÓ&ˆÜˆu‹:˜Œ>Ü Ð,YÐZbÐYcÐcfÐ*gÔhÐhØ˜1•X�J˜a  a¥˜zÐ*ˆÜ#& u£:°¤>�u˜Q–x°r‰à˜7˜FÐ#ˆØ¨¥
 Ð-ˆßÜ Ð*MÔNÐNØ�=‰=˜Ó Ô"Ü Ð,YÐZaÐYbÐbdÐ*eÔfÐfô -×2Ñ2°<Ó@ˆØÒØ—{‘{“}ˆHØ'¬¨H«¨Ð8×EÑEÀcÓJ‰Là$×)Ñ)¨#Ó.ˆIØ˜BŒØ'�Ø!‘à'¨
¨Ð3�Ø+¸­M¨OÐ<�Ü˜8Ó$ˆßÜ Ð*EÔFÐFäØØØØ!Øôð r    c                ó  € V ^8„  d   Qh/ ^ \         9   d   \        \        \        3,          ;R&   ^\         9   d   \        \        ,          ;R&   ^\         9   d   \        \        ,          ;R&   ^\         9   d   \        \        ,          ;R&   # )r   rL   r,   r¾   r½   )Ú__conditional_annotations__Údictr0   r    )r   s   "r   r   r      st   € ÷ ñ ÷T \Ò [””cœ3�h•Ñ [ñU÷h VÒ U”)œC•.Ñ Uñi÷t dÒ cœI¤c�NÑ cñu÷z NÒ Mœi¬�nÑ Mò{r    >   rv   Úblobr   Úblamer   re   ),rì   rj   Ú	functoolsÚreÚdataclassesr   r   Úurllib.parser   r   r   Úhuggingface_hubr   Úhuggingface_hub.errorsr   r	   Ú_validatorsr
   r¼   ÚitemsrL   ÚcompilerM   r    Úvaluesr,   r¾   r½   r   rq   r…   Ú	lru_cacher„   rž   r¤   r�   r°   rŽ   rÎ   rÌ   r�   r�   r‘   r   )ÚkÚvrì   s   00@r   Ú<module>rý      sJ  øðöó: Û 	ß (ß 1Ñ 1å %ß @å )ð
 5>×4RÑ4R×4XÑ4XÔ4ZÔ"[Ñ4Z©D¨A 1¢4Ñ4ZÒ"[€Ó [ð  "ŸzšzÐ*MÓNÐ ñ $-¨Y×-KÑ-K×-RÑ-RÓ-TÓ#UÐ Ó Uñ .7Ò7bÓ-cÐ Ó cñ 09¸)ÀVÐ9LÓ/MÐ Ó Mñ �$Ô÷|ð |ó ð|ñ~ �$Ô÷'ð 'ó ð'õTð ×Ñö<6ó ð<6õ~(õO÷jõ0÷O*õd7Xõt+õ<õ>÷08ùóe #\s   ÁE