Ë
‚Ö¦ilÇ ã ó — d Z ddlZddlZddlZddlZddlZddlZddlZddlZddl Z ddl
mZ ddlm
Z
mZmZmZ ddlmZmZmZmZmZmZmZ ddlmZ g d¢Z eh d£d D � ch c] } d
| › �’Œ c} z d D � ch c] } d| › �’Œ c} z « ZdZd
Z dZ!e
eeefZ"ee e!fZ#d„ Z$ejJ d„ « Z& ejN d« jQ d« \ Z)Z* e+ e,e)« e,e*« « Z-e.j_ dddœ« e.j_ dddœ« dœZ0 ejb « d„ « Z2 ejb d¬« d„ « Z3 ejb « d„ « Z4 G d„ d« Z5 G d„ d « Z6 G d!„ d"e5« Z7 G d#„ d$e5« Z8 G d%„ d&e5« Z9 G d'„ d(e9« Z: G d)„ d*e« Z; G d+„ d,e<« Z=ej| j e=« G d-„ d.e=« Z@ G d/„ d0e=« ZA G d1„ d2e=« ZB G d3„ d4eBe@« ZC G d5„ d6eBeA« ZDyc c} w c c} w )7zÀObject-oriented filesystem paths.
This module provides classes to represent abstract paths and concrete
paths with operations that have semantics appropriate for different
operating systems.
é N)ÚSequence)ÚENOENTÚENOTDIRÚEBADFÚELOOP)ÚS_ISDIRÚS_ISLNKÚS_ISREGÚS_ISSOCKÚS_ISBLKÚS_ISCHRÚS_ISFIFO)Úquote_from_bytes)ÚPurePathÚ
PurePosixPathÚPureWindowsPathÚPathÚ PosixPathÚWindowsPath> úCONIN$úCONOUT$ÚAUXÚCONÚNULÚPRNu 123456789¹²³ÚCOMÚLPTé é{ i� c óR — t | dd « t v xs t | dd « t v S )NÚerrnoÚwinerror)ÚgetattrÚ_IGNORED_ERRNOSÚ_IGNORED_WINERRORS)Ú exceptions ú /usr/lib64/python3.12/pathlib.pyÚ
_ignore_errorr( 4 s1 € Ü�I˜w¨Ó-´Ð@ò
GÜ�I˜z¨4Ó0Ô4FÐFðHó c ó* — | j d« dk( S )NÚAa)Únormcase)Úflavours r' Ú_is_case_sensitiver. 9 s € à×јDÓ! TÑ)Ð)r) Ú_Ú
Ú/)r1 r0 Ú\)r2 r0 )r1 r2 c ó& — | d }|s
t « S |dk( rKd}|t | « k r$| | dk( r|dz
}|t | « k r | | dk( rŒ| |d }d|v rt }n-t }n&| dd }|dk( rt }nd|v rt d« ‚t } |||||« S )Nr ú**é ú..z:Invalid pattern: '**' can only be an entire path component)Ú_TerminatingSelectorÚlenÚ _DoubleRecursiveWildcardSelectorÚ_RecursiveWildcardSelectorÚ_ParentSelectorÚ
ValueErrorÚ_WildcardSelector)Ú
pattern_partsr- Úcase_sensitiveÚpatÚchild_parts_idxÚchild_partsÚclss r' Ú_make_selectorrD Q sÄ € à
˜Ñ
€CÙÜ#Ó%Ð%Ø
ˆd‚{؈ؤ MÓ 2Ò2°}À_Ñ7UÐY]Ò7]ؘqÑ ˆOð ¤ MÓ 2Ò2°}À_Ñ7UÐY]Ó7]à# OÐ$4Ð5ˆØ�;ÑÜ2‰Cä,‰Cà# A BÐ'ˆØ�$Š;Ü!‰CØ
�S‰[ÜÐYÓZÐZä#ˆCÙˆs�K ¨.Ó9Ð9r) é )Úmaxsizec ó¬ — |rt j nt j }t j t j
| « |« j S ©N)ÚreÚNOFLAGÚ
IGNORECASEÚcompileÚfnmatchÚ translateÚmatch)r@ r? Úflagss r' Ú_compile_patternrQ j s5 € á'ŒB�IŠI¬R¯]©]€EÜ
�:‰:”g×'Ñ'¨Ó,¨eÓ4×:Ñ:Ð:r) c óh — dg}| j d¬« D ]? }|dk( rd}n$|dk( rd}nt j |« t }|j |« ŒA |j d« t
j }|s|t
j z }t j d j |« |¬
« S )aY Compile the given pattern lines to an `re.Pattern` object.
The *pattern_lines* argument is a glob-style pattern (e.g. '*/*.py') with
its path separators and newlines swapped (e.g. '*
*.py`). By using
newlines to separate path components, and not setting `re.DOTALL`, we
ensure that the `*` wildcard cannot match path separators.
The returned `re.Pattern` object may have its `match()` method called to
match a complete pattern, or `search()` to match from the right. The
argument supplied to these methods must also have its path separators and
newlines swapped.
Ú^T)Úkeependsz*
z.+\nÚ*z.+z\ZÚ )rP )
Ú
splitlinesrM rN Ú_FNMATCH_SLICEÚappendrI Ú MULTILINErK rL Újoin)Ú
pattern_linesr? ÚpartsÚpartrP s r' Ú_compile_pattern_linesr_ p sŸ € ð ˆE€EØ×(Ñ(°$Ð(Ö7ˆØ�5Š=؉DØ
�SŠ[؉Dô ×$Ñ$ TÓ*¬>Ñ:ˆDØ
�‰�TÕð 8ð
‡L�L�ÔÜ�L‰L€EÙØ
”—‘шÜ
�:‰:�b—g‘g˜e“n¨EÔ2Ð2r) c ó — e Zd ZdZd„ Zd„ Zy)Ú _SelectorzYA selector matches a specific glob pattern part against the children
of a given path.c óv — || _ |rt |||« | _ d| _ y t « | _ d| _ y )NTF)rB rD Ú successorÚdironlyr7 )ÚselfrB r- r? s r' Ú__init__z_Selector.__init__› s5 € Ø&ˆÔÙÜ+¨K¸À.ÓQˆDŒN؈D�Lä1Ó3ˆDŒNØ ˆD�Lr) c óŠ — t |« }|j }|j « st g « S | j ||« S )zuIterate over all child paths of `parent_path` matched by this
selector. This can contain parent_path itself.)ÚtypeÚ_scandirÚis_dirÚiterÚ_select_from)re Úparent_pathÚpath_clsÚscandirs r' Úselect_fromz_Selector.select_from¤ sA € ô ˜Ó$ˆØ×#Ñ#ˆØ×!Ñ!Ô#ܘ“8ˆOØ× Ñ ¨gÓ6Ð6r) N)Ú__name__Ú
__module__Ú__qualname__Ú__doc__rf rp © r) r' ra ra — s „ ñò!ó7r) ra c ó — e Zd Zd„ Zy)r7 c # ó K — |–— y wrH ru )re rm ro s r' rl z!_TerminatingSelector._select_from° s è ø€ ØÓùs ‚N)rq rr rs rl ru r) r' r7 r7 ® s „ ór) r7 c ó — e Zd Zd„ Zd„ Zy)r; c ó4 — t j | |||« y rH ©ra rf )re ÚnamerB r- r? s r' rf z_ParentSelector.__init__¶ ó € Ü×ј4 ¨g°~ÕFr) c # óx K — |j d« }| j j ||« D ] }|–— Œ y w)Nr6 )Ú_make_child_relpathrc rl )re rm ro ÚpathÚps r' rl z_ParentSelector._select_from¹ s6 è ø€ Ø×.Ñ.¨tÓ4ˆØ—‘×,Ñ,¨T°7Ö;ˆAØ‹Gñ <ùs ‚8:N©rq rr rs rf rl ru r) r' r; r; ´ s
„ òGór) r; c ó — e Zd Zd„ Zd„ Zy)r= c óp — t j | |||« |€t |« }t ||« | _ y rH )ra rf r. rQ rO ©re r@ rB r- r? s r' rf z_WildcardSelector.__init__Á s4 € Ü×ј4 ¨g°~ÔFØÐ!ä/°Ó8ˆNÜ% c¨>Ó:ˆ�
r) c # óŽ K — ||« 5 }t |« }d d d « D ]u }| j r |j « sŒ! |j }| j |« sŒ@|j
|« }| j j ||« D ] }|–— Œ Œw y # 1 sw Y Œ„xY w# t $ r Y Œ�w xY w# t $ r Y y w xY wwrH ) Úlistrd rj ÚOSErrorr{ rO r~ rc rl ) re rm ro Ú
scandir_itÚentriesÚentryr{ r r€ s r' rl z_WildcardSelector._select_fromÈ sÅ è ø€ ð ñ ˜Ô%¨Ü˜zÓ*�÷ &ó
!�Ø—<’<ð!Ø$Ÿ|™|œ~Ø$ð .ð —z‘z�Ø—:‘:˜dÕ#Ø&×:Ñ:¸4Ó@�DØ!Ÿ^™^×8Ñ8¸¸wÖG˜Ø›ñ Hñ !÷ &Ð%ûô #ò !Ù ð!ûô ò Ùð üsf ‚C„B6 ŒB˜B6 C²B'ÁCÁ"9CÂB$ B6 Â' B3Â0CÂ2B3Â3CÂ6 CÂ?CÃCÃCNr� ru r) r' r= r= ¿ s „ ò;ó r) r= c ó — e Zd Zd„ Zd„ Zd„ Zy)r: c ó4 — t j | |||« y rH rz r„ s r' rf z#_RecursiveWildcardSelector.__init__á r| r) c # óz K — |–— |j « D ] \ }}}|D ] }|j |« –— Œ Œ" y wrH )Úwalkr~ )re rm ÚdirpathÚdirnamesr/ Údirnames r' Ú_iterate_directoriesz/_RecursiveWildcardSelector._iterate_directoriesä sA è ø€ ØÒØ$/×$4Ñ$4Ö$6Ñ ˆG�X˜qÛ#�Ø×1Ñ1°'Ó:Ó:ñ $ñ %7ùs ‚9;c # óˆ K — | j j }| j |« D ] } |||« D ] }|–— Œ Œ y wrH )rc rl r’ )re rm ro Úsuccessor_selectÚstarting_pointr€ s r' rl z'_RecursiveWildcardSelector._select_fromê sB è ø€ ØŸ>™>×6Ñ6ÐØ"×7Ñ7¸ÖDˆNÙ% n°gÖ>�Ø“ñ ?ñ Eùs ‚A AN)rq rr rs rf r’ rl ru r) r' r: r: ß s „ òGò;ór) r: c ó" ‡ — e Zd ZdZˆ fd„Zˆ xZS )r9 z»
Like _RecursiveWildcardSelector, but also de-duplicates results from
successive selectors. This is necessary if the pattern contains
multiple non-adjacent '**' segments.
c # óÎ •K — t « } t ‰| � ||« D ] }||vsŒ|–— |j |« Œ |j « y # |j « w xY wwrH )ÚsetÚsuperrl ÚaddÚclear)re rm ro Úyieldedr€ Ú __class__s €r' rl z-_DoubleRecursiveWildcardSelector._select_fromø sV øè ø€ Ü“%ˆð Ü‘WÑ)¨+°wÖ?�ؘGÒ#Ø’GØ—K‘K •Nñ @ð
�M‰M�OøˆG�M‰M�Oüs ƒA%�A §A ¿A%ÁA"Á"A%)rq rr rs rt rl Ú
__classcell__©r� s @r' r9 r9 ñ s ø„ ñ÷ð r) r9 c ó, — e Zd ZdZdZd„ Zd„ Zd„ Zd„ Zy)Ú_PathParentszvThis object provides sequence-like access to the logical ancestors
of a path. Don't try to construct it yourself.)Ú_pathÚ_drvÚ_rootÚ_tailc óx — || _ |j | _ |j | _ |j
| _ y rH )r¢ Údriver£ Úrootr¤ r¥ ©re r s r' rf z_PathParents.__init__ s* € ؈Œ
Ø—J‘JˆŒ Ø—Y‘YˆŒ
Ø—Z‘Zˆ�
r) c ó, — t | j « S rH )r8 r¥ ©re s r' Ú__len__z_PathParents.__len__ s € Ü�4—:‘:‹Ðr) c
ó‚ ‡ — t |t « r2t ˆ fd„t |j t ‰ « « Ž D « « S |t ‰ « k\ s|t ‰ « k rt
|« ‚|dk r|t ‰ « z
}‰ j j ‰ j ‰ j ‰ j d | dz
« S )Nc 3 ó( •K — | ] }‰| –— Œ y wrH ru )Ú.0Úire s €r' Ú