Ë
    #täi“  ã                   óB   — d dl Z d dlZd dlmZ ddlmZ  G d„ de«      Zy)é    N)ÚAbstractFileSystemé   )Ú
MemoryFilec                   ó’   ‡ — e Zd ZdZdZdZdˆ fd„	Zeˆ fd„«       Zd„ Z	e
d„ «       Ze
dd„«       Zdd	„Zdd
„Zdd„Z	 	 	 	 	 dd„Zˆ xZS )ÚGitFileSystemz\Browse the files of a local git repo at any hash/tag/branch

    (experimental backend)
    Ú Tc                 ó¢   •— t        ‰| �  di |¤Ž t        j                  |xs |xs t	        j
                  «       «      | _        |xs d| _        y)aM  

        Parameters
        ----------
        path: str (optional)
            Local location of the repo (uses current directory if not given).
            May be deprecated in favour of ``fo``. When used with a higher
            level function such as fsspec.open(), may be of the form
            "git://[path-to-repo[:]][ref@]path/to/file" (but the actual
            file path should not contain "@" or ":").
        fo: str (optional)
            Same as ``path``, but passed as part of a chained URL. This one
            takes precedence if both are given.
        ref: str (optional)
            Reference to work with, could be a hash, tag or branch name. Defaults
            to current working tree. Note that ``ls`` and ``open`` also take hash,
            so this becomes the default for those operations
        kwargs
        ÚmasterN© )ÚsuperÚ__init__Úpygit2Ú
RepositoryÚosÚgetcwdÚrepoÚref)ÚselfÚpathÚfor   ÚkwargsÚ	__class__s        €úi/Volumes/fast/ai/experiments/MLX_z-image/.venv/lib/python3.12/site-packages/fsspec/implementations/git.pyr   zGitFileSystem.__init__   sB   ø€ ô( 	‰ÑÑ"˜6Ò"Ü×%Ñ% bÒ&?¨DÒ&?´B·I±I³KÓ@ˆŒ	Ø’?˜(ˆ�ó    c                 óÆ   •— t         ‰| �  |«      j                  d«      }d|v r|j                  dd«      d   }d|v r|j                  dd«      d   }|j                  d«      S )NÚ/Ú:r   Ú@)r   Ú_strip_protocolÚlstripÚsplit)Úclsr   r   s     €r   r   zGitFileSystem._strip_protocol+   sd   ø€ ä‰wÑ& tÓ,×3Ñ3°CÓ8ˆØ�$‰;Ø—:‘:˜c 1Ó% aÑ(ˆDØ�$‰;Ø—:‘:˜c 1Ó% aÑ(ˆDØ�{‰{˜3ÓÐr   c                 ó
  — | j                   j                  |xs | j                  «      \  }}|j                  d«      }|j                  }|D ]4  }|sŒt        |t        j                  «      sŒ!||vrt        |«      ‚||   }Œ6 |S )Nr   )	r   Úresolve_refishr   r!   ÚtreeÚ
isinstancer   ÚTreeÚFileNotFoundError)r   r   r   ÚcommÚpartsr%   Úparts          r   Ú_path_to_objectzGitFileSystem._path_to_object4   su   € Ø—I‘I×,Ñ,¨Sª_°D·H±HÓ=‰	ˆˆcØ—
‘
˜3“ˆØ�y‰yˆÛˆDÚœ
 4¬¯©Õ5Ø˜tÑ#Ü+¨DÓ1Ð1Ø˜D‘z‘ð	 ð
 ˆr   c                 óœ   — | j                  d«      } i }d| v r| j                  dd«      \  |d<   } d| v r| j                  dd«      \  |d<   } |S )Nzgit://r   r   r   r   r   )Úremoveprefixr!   )r   Úouts     r   Ú_get_kwargs_from_urlsz#GitFileSystem._get_kwargs_from_urls?   s\   € à× Ñ  Ó*ˆØˆØ�$‰;Ø $§
¡
¨3°Ó 2ÑˆC�‰K˜Ø�$‰;Ø#Ÿz™z¨#¨qÓ1ÑˆC�‰J˜Øˆ
r   c                 ó@  — t        | t        j                  «      }|rdnd|r0dj                  || j                  xs dg«      j                  d«      n| j                  t        | j                  «      | j                  €dn| j                  d›|rddœS | j                  dœS )	NÚ	directoryÚfiler   r   Ú100644Úor   )ÚtypeÚnameÚhexÚmodeÚsize)
r&   r   r'   Újoinr7   r    ÚstrÚidÚfilemoder:   )Úobjr   Úis_dirs      r   Ú_object_to_infozGitFileSystem._object_to_infoI   s‹   € ô ˜C¤§¡Ó-ˆá#)‘K¨vá@D�—‘˜$ §¡¢¨BÐ/Ó0×7Ñ7¸Ô<È#Ï(É(ä�s—v‘v“;Ø #§¡Ð 4‘H¸S¿\¹\È!Ð<LÙ�Añ
ð 	
ð &)§X¡Xñ
ð 	
r   c                 ó  — | j                  | j                  |«      |«      }t        |t        j                  «      r|n|gD �cg c]3  }|rt
        j                  ||«      nt
        j                  ||«      d   ‘Œ5 c}S c c}w )Nr7   )r,   r   r&   r   r'   r   rA   )r   r   Údetailr   r   r%   r?   s          r   ÚlszGitFileSystem.lsW   s�   € Ø×#Ñ# D×$8Ñ$8¸Ó$>ÀÓDˆô
 !+¨4´·±Ô =™ÀDÀ6ÐIó	
ñ J�ñ ô ×)Ñ)¨#¨tÔ4ä×.Ñ.¨s°DÓ9¸&ÑAñBð Jñ	
ð 	
ùò 
s   Á8A>c                 óp   — | j                  | j                  |«      |«      }t        j                  ||«      S ©N)r,   r   r   rA   )r   r   r   r   r%   s        r   ÚinfozGitFileSystem.info`   s2   € Ø×#Ñ# D×$8Ñ$8¸Ó$>ÀÓDˆÜ×,Ñ,¨T°4Ó8Ð8r   c                 ó.   — | j                  ||¬«      d   S )N)r   r8   )rG   )r   r   r   s      r   ÚukeyzGitFileSystem.ukeyd   s   € Ø�y‰y˜ 3ˆyÓ'¨Ñ.Ð.r   c                 ón   — | j                  ||xs | j                  «      }t        |j                  ¬«      S )N)Údata)r,   r   r   rK   )	r   r   r9   Ú
block_sizeÚ
autocommitÚcache_optionsr   r   r?   s	            r   Ú_openzGitFileSystem._openg   s-   € ð ×"Ñ" 4¨ª°·±Ó9ˆÜ˜sŸx™xÔ(Ð(r   )NNNrF   )TN)ÚrbNTNN)Ú__name__Ú
__module__Ú__qualname__Ú__doc__Úroot_markerÚcachabler   Úclassmethodr   r,   Ústaticmethodr0   rA   rD   rG   rI   rO   Ú__classcell__)r   s   @r   r   r   
   s   ø„ ñð
 €KØ€Hõ#ð0 ó ó ð ò	ð ñó ðð ò
ó ð
ó
ó9ó/ð ØØØØ÷)r   r   )r   r   Úfsspec.specr   Úmemoryr   r   r   r   r   Ú<module>r\      s    ðÛ 	ã å *å ôh)Ð&õ h)r   