ó
    ‘óýj¯A  ã                   óP  • S r / SQrSSKrSSKrSSKrSSKrSSKJrJrJ	r	J
r
Jr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  \R.                  " \5      r\\-  S-  rS\S\\\4   4S jrS\\   S\\\\\\4   4   SS4   4S jrS S\S\S\4S jjr  " S S5      r!S\	\\!\\\4   4      S\S\"\\4   4S jr#  S!S\	\\\\\4   4      S\$\-  S\S\%\\!\\\4   4      4S jjr&S\$\-  S\%\\!\\\4   4      4S jr'S\$\-  S\%\\!\\\4   4      4S jr( " S S5      r)g)"zParse .gitattributes file.)ÚAttributeValueÚGitAttributesÚPatternÚcompile_gitattributes_patternsÚ
match_pathÚparse_git_attributesÚparse_gitattributes_fileÚread_gitattributesé    N)ÚCallableÚ	GeneratorÚIterableÚIteratorÚMappingÚSequence)Úchain)ÚIOé   )Úopen_nofollow_read)ÚMalformedPattern)Ú	translateÚattrÚreturnc                 ó¸   • U R                  S5      (       a  U SS S4$ U R                  S5      (       a  U SS S4$ SU ;  a  U S4$ U R                  S5      u  pnX4$ )zÖParse a git attribute into its value.

>>> _parse_attr(b'attr')
(b'attr', True)
>>> _parse_attr(b'-attr')
(b'attr', False)
>>> _parse_attr(b'!attr')
(b'attr', None)
>>> _parse_attr(b'attr=text')
(b'attr', b'text')
ó   !r   Nó   -Fó   =T)Ú
startswithÚ	partition)r   ÚnameÚ_Úvalues       Ú8/usr/local/lib/python3.13/site-packages/dulwich/attrs.pyÚ_parse_attrr#   5   sn   € ð ‡��t×ÑØ�A�Bˆx˜ˆ~ÐØ‡��t×ÑØ�A�Bˆx˜ˆÐØ�4ÓØ�TˆzÐà—^‘^ DÓ)�N€DˆUØˆ;Ðó    Úfc              #   óò   #   • U  Hg  nUR                  5       nU(       d  M  UR                  S5      (       a  M4  UR                  5       tp#US U 5        VVs0 s H  u  pEXE_M	     snn4v •  Mi     gs  snnf 7f)aÛ  Parse a Git attributes string.

Args:
  f: File-like object to read bytes from
Returns:
  List of patterns and corresponding patterns in the order or them being encountered
>>> from io import BytesIO
>>> list(parse_git_attributes(BytesIO(b'''*.tar.* filter=lfs diff=lfs merge=lfs -text
...
... # store signatures in Git
... *.tar.*.asc -filter -diff merge=binary -text
...
... # store .dsc verbatim
... *.dsc -filter !diff merge=binary !text
... '''))) #doctest: +NORMALIZE_WHITESPACE
[(b'*.tar.*', {'filter': 'lfs', 'diff': 'lfs', 'merge': 'lfs', 'text': False}),
 (b'*.tar.*.asc', {'filter': False, 'diff': False, 'merge': 'binary', 'text': False}),
 (b'*.dsc', {'filter': False, 'diff': None, 'merge': 'binary', 'text': None})]
ó   #c              3   ó8   #   • U  H  n[        U5      v •  M     g 7f©N)r#   )Ú.0Úas     r"   Ú	<genexpr>Ú'parse_git_attributes.<locals>.<genexpr>o   s   é € Ð*IÂ5¸a¬;°q¯>¨>Â5ùs   ‚N)Ústripr   Úsplit)r%   ÚlineÚpatternÚattrsÚkÚvs         r"   r   r   L   so   é € ó, ˆØ�z‰z‹|ˆö Ùà�?‰?˜4× Ñ áàŸ*™*›,ˆˆàÑ*IÁ5Ô*IÔJÒ*I¡$ !˜šÑ*IÒJÐKÔKò ùó Kùs   ‚AA7ÁA1
Á%A7r1   Úbasec                 ó°   • U(       a  [         R                  " US-   5      OSnSU ;  a  US-  nOU R                  S5      (       a  U SS n U[        U 5      -   $ )aö  Translate a gitattributes pattern to a regular expression.

Similar to gitignore patterns, but simpler as gitattributes doesn't support
all the same features (e.g., no directory-only patterns with trailing /).

Args:
  pattern: The pattern to translate
  base: Directory of the .gitattributes file the pattern comes from,
    relative to the repository root; empty for the root

Raises:
  MalformedPattern: if wildmatch() would refuse the pattern outright;
    see :func:`dulwich.wildmatch.translate`.
ó   /r$   s	   (?:.*/)??r   N)ÚreÚescaper   Útranslate_wildmatch)r1   r5   Úress      r"   Ú_translate_patternr<   r   s[   € ö %)Œ"�)Š)�D˜4‘KÔ
 ¨c€Cð �7ÓØˆ|Ñ‰Ø	×	Ñ	˜D×	!Ñ	!à˜!˜"�+ˆàÔ$ WÓ-Ñ-Ð-r$   c                   óJ   • \ rS rSrSrSS\S\4S jjrSS jrS	\S\4S
 jr	Sr
g)r   é�   zA single gitattributes pattern.r1   r5   c                 óJ   • Xl         X l        SU l        U R                  5         g)zÑInitialize GitAttributesPattern.

Args:
    pattern: Attribute pattern as bytes
    base: Directory of the .gitattributes file the pattern comes
      from, relative to the repository root; empty for the root
N)r1   r5   Ú_regexÚ_compile)Úselfr1   r5   s      r"   Ú__init__ÚPattern.__init__�   s   € ð ŒØŒ	Ø04ˆŒØ�‰�r$   r   Nc                 óŠ   • [        U R                  U R                  5      nSU-   S-   n[        R                  " U5      U l        g)z,Compile the pattern to a regular expression.ó   ^ó   $N)r<   r1   r5   r8   Úcompiler@   )rB   Úregex_patterns     r"   rA   ÚPattern._compile�   s5   € ä*¨4¯<©<¸¿¹ÓCˆà˜}Ñ,¨tÑ3ˆÜ—j’j Ó/ˆ�r$   Úpathc                 óž   • UR                  S5      (       a  USS nU R                  c   e[        U R                  R                  U5      5      $ )z¥Check if path matches this pattern.

Args:
    path: Path to check (relative to repository root, using / separators)

Returns:
    True if path matches this pattern
r7   r   N)r   r@   ÚboolÚmatch)rB   rK   s     r"   rN   ÚPattern.match¤   sJ   € ð �?‰?˜4× Ñ Ø˜˜�8ˆDð �{‰{Ñ&Ð&Ð&Ü�D—K‘K×%Ñ% dÓ+Ó,Ð,r$   )r@   r5   r1   ©r$   )r   N)Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__ÚbytesrC   rA   rM   rN   Ú__static_attributes__© r$   r"   r   r   �   s0   † Ù)ñ ð ¨Uõ ô0ð-˜%ð - D÷ -r$   r   ÚpatternsrK   c                 ó¸   • 0 nU  HQ  u  p4UR                  U5      (       d  M  UR                  5        H   u  pVUc  UR                  US5        M  XbU'   M"     MS     U$ )zçGet attributes for a path by matching against patterns.

Args:
    patterns: List of (Pattern, attributes) tuples
    path: Path to match (relative to repository root)

Returns:
    Dictionary of attributes that apply to this path
N)rN   ÚitemsÚpop)rY   rK   Ú
attributesr1   r2   r   r!   s          r"   r   r   ¶   s[   € ð /1€Jó #‰ˆØ�=‰=˜×Óà$Ÿ{™{ž}‘�Ø‘=à—N‘N 4¨Ö.à',˜tÓ$ó  -ñ #ð Ðr$   ÚentriesÚsourcec                 óª   • / nU  H#  u  pE [        XB5      nUR	                  Xe45        M%     U$ ! [         a    [        R                  SXA5         ML  f = f)a  Compile parsed gitattributes entries, skipping malformed patterns.

Git's wildmatch() treats a malformed pattern as matching nothing rather
than as a broken file, so one bad line is logged and dropped instead of
aborting the load.

Args:
    entries: (pattern, attributes) pairs, as from parse_git_attributes
    source: Where the entries came from, used in the warning
    base: Directory the patterns are relative to, relative to the
      repository root; empty for the root

Returns:
    List of (Pattern, attributes) tuples
z#Ignoring malformed pattern %r in %r)r   r   ÚloggerÚwarningÚappend)r^   r_   r5   rY   Úpattern_bytesr2   r1   s          r"   r   r   Ò   s`   € ð( €HÛ 'Ñˆð	Ü˜mÓ2ˆGð 	�‰˜Ð(Ö)ñ !(ð €Oøô	  ó 	Ü�N‰NÐ@À-ÔXÚð	ús   ‹.® AÁAÚfilenamec                 óÆ   • [        U [        5      (       a  U R                  S5      n [        U S5       n[	        [        U5      U 5      sSSS5        $ ! , (       d  f       g= f)a   Parse a gitattributes file and return compiled patterns.

A malformed pattern is logged and skipped rather than raised, so one bad
line doesn't stop the rest of the file from loading.

Args:
    filename: Path to the .gitattributes file

Returns:
    List of (Pattern, attributes) tuples
úutf-8ÚrbN)Ú
isinstanceÚstrÚencodeÚopenr   r   )re   r%   s     r"   r   r   ñ   sG   € ô �(œC× Ñ Ø—?‘? 7Ó+ˆä	ˆh˜Ô	 Ü-Ô.BÀ1Ó.EÀxÓP÷ 
×	×	ús   ³AÁ
A c                 óþ  • [        U [        5      (       a  U R                  S5      n [        R                  R                  U S5      n [        U5      nU   [        [        U5      UR!                  S5      5      sSSS5        $ ! [         a    / s $ [         aQ  nUR                  [        R                  [        R                  4;  a  e [        R                  SU5        / s SnA$ SnAff = f! , (       d  f       g= f)zúRead .gitattributes from a directory.

A ``.gitattributes`` that is a symlink is skipped with a warning rather
than followed, as git does.

Args:
    path: Directory path to check for .gitattributes

Returns:
    List of (Pattern, attributes) tuples
rg   z.gitattributesz"Ignoring %s: it is a symbolic linkN)ri   rV   ÚdecodeÚosrK   Újoinr   ÚFileNotFoundErrorÚOSErrorÚerrnoÚELOOPÚEMLINKra   rb   r   r   rk   )rK   Úgitattributes_pathr%   Úes       r"   r	   r	     sÇ   € ô �$œ×ÑØ�{‰{˜7Ó#ˆäŸ™Ÿ™ dÐ,<Ó=ÐðÜÐ1Ó2ˆò 
Ü-Ü  Ó#Ð%7×%>Ñ%>¸wÓ%Gó
÷ 
‰øô ó ØŠ	Üó Ø�7‰7œ5Ÿ;™;¬¯©Ð5Ó5ØÜ�‰Ð;Ð=OÔPØ�	ûð	ú÷
 
�ús1   ÁB Á$C.ÂC+Â	C+ÂAC&Ã C+Ã&C+Ã.
C<c                   óê  • \ rS rSrSr SSSS.S\\\\\	\
4   4      S-  S\\	/\\\\\	\
4   4      4   S-  S\\\\\	\
4   4      S-  4S jjjrS	\	S
\\\\\	\
4   4      4S jrS\	S
\\	\
4   4S jrS\\\\\	\
4   4      S
S4S jrS
\4S jrS
\\S\\	\
4   4      4S jr\S\\	-  S
S 4S j5       r\S\\	-  S
S 4S j5       rS\	S\	S\
S
S4S jrS\	S
S4S jrS
\	4S jrS\\	-  S
S4S jrSrg)r   i'  a  A collection of gitattributes patterns that can match paths.

Patterns are applied in the order git uses: ``patterns`` first, then
those of each directory from the top down to the path's own directory
(as returned by ``directory_loader``), then ``info_patterns``.
N)Údirectory_loaderÚinfo_patternsrY   ry   rz   c                ó^   • U=(       d    / U l         X l        0 U l        U=(       d    / U l        g)añ  Initialize GitAttributes.

Args:
    patterns: Optional list of (Pattern, attributes) tuples
    directory_loader: Optional callable that returns the patterns
      of the .gitattributes file in a subdirectory, given its path
      relative to the repository root. Called at most once per
      directory, when a path below it is first matched.
    info_patterns: Optional list of (Pattern, attributes) tuples
      that take precedence over all others, as from
      ``$GIT_DIR/info/attributes``
N)Ú	_patternsÚ_directory_loaderÚ_directory_patternsÚ_info_patterns)rB   rY   ry   rz   s       r"   rC   ÚGitAttributes.__init__/  s1   € ð. "Ÿ RˆŒØ!1Ôð ð 	Ô ð ,×1¨rˆÕr$   Údirpathr   c                 ó¢   •  U R                   U   $ ! [         a     Of = fU R                  c   eU R                  U5      nX R                   U'   U$ r)   )r~   ÚKeyErrorr}   )rB   r�   rY   s      r"   Ú_get_directory_patternsÚ%GitAttributes._get_directory_patternsM  s_   € ð	Ø×+Ñ+¨GÑ4Ð4øÜó 	Ùð	úà×%Ñ%Ñ1Ð1Ð1Ø×)Ñ)¨'Ó2ˆØ,4× Ñ  Ñ)Øˆs   ‚ ‘
�rK   c           
      ó`  • / nU R                   bt  UR                  S5      R                  S5      SS n[        S[	        U5      S-   5       H5  nUR                  U R                  SR                  USU 5      5      5        M7     [        [        U R                  /UQU R                  P76 U5      $ )z´Get attributes for a path by matching against patterns.

Args:
    path: Path to match (relative to repository root)

Returns:
    Dictionary of attributes that apply to this path
Nr7   éÿÿÿÿr   )r}   Úlstripr/   ÚrangeÚlenrc   r„   rp   r   r   r|   r   )rB   rK   Údirectory_patternsÚpartsÚis        r"   r   ÚGitAttributes.match_pathY  s¬   € ð ð 	ð ×!Ñ!Ñ-Ø—K‘K Ó%×+Ñ+¨DÓ1°#°2Ð6ˆEÜ˜1œc %›j¨1™nÖ-�Ø"×)Ñ)Ø×0Ñ0°·±¸5ÀÀ!¸9Ó1EÓFöñ .ô Ü�$—.‘.ÐKÐ#5ÐK°t×7JÑ7JÒKÈTó
ð 	
r$   c                 ó:   • U R                   R                  U5        g)zaAdd patterns to the collection.

Args:
    patterns: List of (Pattern, attributes) tuples to add
N)r|   Úextend)rB   rY   s     r"   Úadd_patternsÚGitAttributes.add_patternso  s   € ð 	�‰×Ñ˜hÕ'r$   c                 óX   • [        U R                  5      [        U R                  5      -   $ )zlReturn the number of patterns.

Patterns from subdirectories that have not been loaded yet are
not counted.
)rŠ   r|   r   ©rB   s    r"   Ú__len__ÚGitAttributes.__len__y  s#   € ô �4—>‘>Ó"¤S¨×)<Ñ)<Ó%=Ñ=Ð=r$   r   c              #   ód   #   • U R                    Sh  v•N   U R                   Sh  v•N   g N N7f)zkIterate over the top-level patterns and ``info_patterns``.

Patterns from subdirectories are not included.
N)r|   r   r”   s    r"   Ú__iter__ÚGitAttributes.__iter__�  s+   é € ð
 —>‘>×!Ð!Ø×&Ñ&×&Ñ&ñ 	"Ù&ùs   ‚0’,“0¦.§0®0re   c                 ó(   • [        U5      nU " U5      $ )zŽCreate GitAttributes from a gitattributes file.

Args:
    filename: Path to the .gitattributes file

Returns:
    New GitAttributes instance
)r   )Úclsre   rY   s      r"   Ú	from_fileÚGitAttributes.from_file‰  s   € ô ,¨HÓ5ˆÙ�8‹}Ðr$   c                 ó(   • [        U5      nU " U5      $ )zžCreate GitAttributes from .gitattributes in a directory.

Args:
    path: Directory path to check for .gitattributes

Returns:
    New GitAttributes instance
)r	   )r›   rK   rY   s      r"   Ú	from_pathÚGitAttributes.from_path–  s   € ô & dÓ+ˆÙ�8‹}Ðr$   r1   r   r!   c                 óN  • SnSnSn[        U R                  5       H)  u  nu  p‰UR                  U:X  d  M  Un[        U	5      nUn  O   Uc+  [	        U5      nX#0nU R                  R                  XE45        OUS:¼  d   eUc   eXE4U R                  U'   Uc  [        S5      eX5U'   g)z—Set an attribute for a pattern.

Args:
    pattern: The file pattern
    name: Attribute name
    value: Attribute value (bytes, True, False, or None)
Nr‡   r
   z+attrs_dict should not be None at this point)Ú	enumerater|   r1   Údictr   rc   ÚAssertionError)
rB   r1   r   r!   Úpattern_objÚ
attrs_dictÚpattern_indexr�   Úpr2   s
             r"   Úset_attributeÚGitAttributes.set_attribute£  sÅ   € ð ˆØ9=ˆ
Øˆä& t§~¡~Ö6‰MˆA‰z�Ø�y‰y˜GÕ#Ø�ä! %›[�
Ø !�Ùñ 7ð Ñä! 'Ó*ˆKØ˜ˆJØ�N‰N×!Ñ! ;Ð";Õ<ð ! AÓ%Ð%Ð%ØÑ)Ð)Ð)Ø-8Ð,EˆD�N‰N˜=Ñ)ð ÑÜ Ð!NÓOÐOØ �4Òr$   c                 ó‚   • U R                    VVs/ s H  u  p#UR                  U:w  d  M  X#4PM     snnU l         gs  snnf )zTRemove all attributes for a pattern.

Args:
    pattern: The file pattern to remove
N)r|   r1   )rB   r1   r¨   r2   s       r"   Úremove_patternÚGitAttributes.remove_patternÈ  s9   € ð (,§~¢~ô
Ú'5™8˜1¸¿¹ÀgÑ9M‹JˆQ‹J¡~ò
ˆ�ùó 
s   �;ª;c                 óø  • / nU R                    HÌ  u  p#UR                  n/ n[        UR                  5       5       Hk  u  pgU=SL a    UR	                  U5        M  =SL a    UR	                  SU-   5        M;  c  UR	                  SU-   5        MS   UR	                  US-   U-   5        Mm     U(       d  M¤  US-   SR                  U5      -   nUR	                  U5        MÎ     U(       a  SR                  U5      S-   $ S$ )	z�Convert GitAttributes to bytes format suitable for writing to file.

Returns:
    Bytes representation of the gitattributes file
TFr   r   r   ó    ó   
r$   )r|   r1   Úsortedr[   rc   rp   )	rB   Úlinesr¥   r2   r1   Ú	attr_strsr   r!   r0   s	            r"   Úto_bytesÚGitAttributes.to_bytesÒ  sà   € ð ˆØ"&§.¤.ÑˆKØ!×)Ñ)ˆGØˆIä% e§k¡k£mÖ4‘�ØÝØ!×(Ñ(¨Ö.ÝØ!×(Ñ(¨°©Ö5ÙØ!×(Ñ(¨°©Ö5Øà!×(Ñ(¨°©°uÑ)<Ö=ñ  5÷ ˆyØ ‘~¨¯	©	°)Ó(<Ñ<�Ø—‘˜TÖ"ñ% #1ö( -2ˆu�z‰z˜%Ó  5Ñ(Ð:°sÐ:r$   c                 óÞ   • [        U[        5      (       a  UR                  S5      nU R                  5       n[	        US5       nUR                  U5        SSS5        g! , (       d  f       g= f)zZWrite GitAttributes to a file.

Args:
    filename: Path to write the .gitattributes file
rg   ÚwbN)ri   rj   rk   r´   rl   Úwrite)rB   re   Úcontentr%   s       r"   Úwrite_to_fileÚGitAttributes.write_to_fileï  sN   € ô �h¤×$Ñ$Ø—‘ wÓ/ˆHà—-‘-“/ˆÜ�(˜DÔ! QØ�G‰G�GÔ÷ "×!Ö!ús   ÁAÁ
A,)r}   r~   r   r|   r)   )rQ   rR   rS   rT   rU   ÚlistÚtupler   r   rV   r   r   rC   r„   r£   r   r   r‘   Úintr•   r   r˜   Úclassmethodrj   rœ   rŸ   r©   r¬   r´   rº   rW   rX   r$   r"   r   r   '  sü  † ñð QUð2ð àò2à�u˜W g¨e°^Ð.CÑ&DÐDÑEÑFÈÑMð2ð #ØˆG�T˜% ¨°¸Ð1FÑ)GÐ GÑHÑIÐIñ
ð ñð	2ð ˜E '¨7°5¸.Ð3HÑ+IÐ"IÑJÑKØ
ñö2ð<
Øð
à	ˆe�G˜W U¨NÐ%:Ñ;Ð;Ñ<Ñ	=ô
ð
˜uð 
¨¨e°^Ð.CÑ)Dô 
ð,(Ø   w°¸¸~Ð8MÑ0NÐ'NÑ!OÑPð(à	ô(ð>˜ô >ð'˜( 5¨°G¸EÀ>Ð<QÑ4RÐ)RÑ#SÑTô 'ð ð
  u¡ð 
°ó 
ó ð
ð ð
˜S 5™[ð 
¨_ó 
ó ð
ð#! Uð #!°%ð #!Àð #!ÐSWô #!ðJ
 eð 
°ô 
ð;˜%ô ;ð: c¨E¡kð °d÷ r$   r   rP   )s   <attributes>r$   )*rU   Ú__all__rs   Úloggingro   r8   Úcollections.abcr   r   r   r   r   r   Ú	itertoolsr   Útypingr   Úfiler   Ú	wildmatchr   r   r:   Ú	getLoggerrQ   ra   rV   rM   r   r½   r#   r   r<   r   r£   r   rj   r¼   r   r   r	   r   rX   r$   r"   Ú<module>rÈ      sì  ðñ. !ò	€ó Û Û 	Û 	ß V× VÝ Ý å $Ý 'Ý 7à	×	Ò	˜8Ó	$€à˜‘ Ñ$€ð�eð   e¨^Ð&;Ñ <ô ð.#LØ	ˆ%�yð#Làˆu�U˜G E¨>Ð$9Ñ:Ð:Ñ;¸TÀ4ÐGÑHô#LñL. ð .¨Uð .¸Uõ .÷6&-ñ &-ðRØ�u˜W g¨e°^Ð.CÑ&DÐDÑEÑFðØNSðà	ˆ%�Ð
Ñ ôð< *ØñØ�e˜E 7¨5°.Ð+@Ñ#AÐAÑBÑCðà�%‰Kðð ðð 
ˆ%�˜ ¨Ð!6Ñ7Ð7Ñ
8Ñ9õ	ð>QØ�E‰kðQà	ˆ%�˜ ¨Ð!6Ñ7Ð7Ñ
8Ñ9ôQð*
Ø
�‰+ð
à	ˆ%�˜ ¨Ð!6Ñ7Ð7Ñ
8Ñ9ô
÷BSò Sr$   