
    h^                    ,   % S r SSKJr  SSKrSSKrSSKJr  SSKJr  SSK	J
r
  SSKJr  SSKJr  SS	KJr  SS
KJr  SSKJr  \
(       a  SSKJrJr  SSKJr  SSK	Jr  \(       a  SOSrS\S'   SrS\S'   SrS\S'   SrS\S'   \" \ " S\\(       d  SOS\SS\\S45      5      r!S\S'   Sr"S\S '   \" \" \\S!95      r#S\S"'   \S-S# j5       r$S.S$ jr% S/   S0S% jjr&      S1S& jr'        S2S' jr( S/   S0S( jjr)SS).     S3S* jjr*S4S+ jr+S5S, jr,g)6zLow-level path helpers.    )annotationsN)cache)Path)TYPE_CHECKING)on_win)custom_expandvars)Channel)user_cache_dir   )APP_NAME)IterableIterator)datetime)FinalzC:/ProgramData/conda/tosz/etc/conda/tosr   SITE_TOS_ROOTz$CONDA_ROOT/conda-meta/tosSYSTEM_TOS_ROOTz~/.conda/tosUSER_TOS_ROOTz$CONDA_PREFIX/conda-meta/tosENV_TOS_ROOTz/var/lib/conda/tosz$XDG_CONFIG_HOME/conda/tosz~/.config/conda/tosz	$CONDATOSSEARCH_PATHz*.jsonTOS_GLOB)	appauthor	CACHE_DIRc                D   [        U 5      n U R                  (       d  [        S5      e[        R                  " S5      nUR                  U R                  R                  S5      5        UR                  U R                  R                  S5      5        UR                  5       $ )z;Hash the channel to remove problematic characters (e.g. /).z\`channel` must have a base URL. (hint: `conda.models.channel.MultiChannel` cannot be hashed)sha256zutf-8)
r	   base_url
ValueErrorhashlibnewupdatechannel_locationencodechannel_name	hexdigest)channelhashers     7lib/python3.13/site-packages/conda_anaconda_tos/path.pyhash_channelr'   >   s     gGK
 	

 [["F
MM'**11':;
MM'&&--g67    c                    [        U [        5      (       a  [        U [        R                  5      n O [        U [
        5      (       d  [        S5      e[        U 5      R                  5       $ )z7Expand environment variables and user home in the path.z*`path` must be a string or `pathlib.Path`.)
isinstancestrr   osenvironr   	TypeError
expanduser)paths    r&   get_pathr1   N   sK    $ rzz2d##DEE:  ""r(   c              #     #    [        5       n/ [        QU =(       d    SQ7 HA  n[        U5      =nR                  5       (       d  M%  X1;  d  M,  Uv   UR	                  U5        MC     g7f)zDGet all root metadata paths ordered from highest to lowest priority. N)setr   r1   is_diradd)extend_search_pathseentos_rootr0   s       r&   get_search_pathr:   W   sW      eD?k?%7%=2?X&&D..00T5EJHHTN @s   A A'A'A'c                0    [        U 5      [        U5      -  $ )z1Get the metadata directory for the given channel.)r1   r'   )r9   r$   s     r&   get_tos_dirr<   b   s    
 HW 555r(   c                @    [        X5      UR                  5        S3-  $ )z=Get the metadata file path for the given channel and version.z.json)r<   	timestamp)r9   r$   versions      r&   get_metadata_pathr@   j   s%     x)w/@/@/B.C5,IIIr(   c              #     #    [        U 5       H5  n[        [        U5      R                  S[         35      5       Sh  vN   M7     g N	7f)z"Get all local metadata file paths.z*/N)r:   sortedr1   globr   )r7   r0   s     r&   get_all_channel_pathsrD   s   s=        23(4.--8*o>??? 4?s   <A
A
A
)r7   c             #     #    [        U5       H2  n[        [        X 5      R                  [        5      5       Sh  vN   M4     g N	7f)z8Get all local metadata file paths for the given channel.N)r:   rB   r<   rC   r   )r$   r7   r0   s      r&   get_channel_pathsrF   {   s8        23+d499(CDDD 4Ds   9AA
Ac                ,    [         [        U 5       S3-  $ )z7Get the metadata cache file path for the given channel.z.cache)r   r'   )r$   s    r&   get_cache_pathrH      s    ,w/0777r(   c               #  \   #    [        [        R                  S5      5       Sh  vN   g N7f)z(Get all local metadata cache file paths.z*.cacheN)rB   r   rC   r3   r(   r&   get_cache_pathsrJ      s     innY/000s   ",*,)r$   str | Channelreturnr+   )r0   str | os.PathLike[str] | PathrL   r   )N)r7   .Iterable[str | os.PathLike[str] | Path] | NonerL   Iterator[Path])r9   rM   r$   rK   rL   r   )r9   rM   r$   rK   r?   r   rL   r   )r$   rK   r7   rN   rL   rO   )r$   rK   rL   r   )rL   rO   )-__doc__
__future__r   r   r,   	functoolsr   pathlibr   typingr   conda.common.compatr   conda.common.configurationr   conda.models.channelr	   platformdirsr
    r   collections.abcr   r   r   r   r   __annotations__r   r   r   tuplefilterr   r   r   r'   r1   r:   r<   r@   rD   rF   rH   rJ   r3   r(   r&   <module>r^      s    "  	     & 8 ( ' 2! 6<1AQu Q 6 5 &u % 5e 4 
(. D(!
	
U $ %  x8DE	5 E  # JNF6+66 
6J+JJ J 
	J JN@F@@ JNEE GE 	E8
1r(   