a0bi S SK r S SKrS SKrS SKrS SKrS SKrS SKr\R S: a S SKJ r O\
r S/rS rS r
\ R r S r " S S \R" 5 r " S
S\5 rS r " S
S5 rg) N) )OrderedDictPathc D [ R " [ U 5 SS5 $ )z
Given a path with elements separated by
posixpath.sep, generate all parents of that path.
>>> list(_parents('b/d'))
['b']
>>> list(_parents('/b/d/'))
['/b']
>>> list(_parents('b/d/f/'))
['b/d', 'b']
>>> list(_parents('b'))
[]
>>> list(_parents(''))
[]
N) itertoolsislice _ancestrypaths ړ/builddir/build/BUILDROOT/alt-python313-setuptools-69.0.2-3.el8.x86_64/opt/alt/python313/lib/python3.13/site-packages/pkg_resources/_vendor/zipp.py_parentsr s IdOQ55 c # # U R [ R 5 n U ( aP U [ R :w a; U v [ R " U 5 u pU ( a U [ R :w a M9 gggg7f)a
Given a path with elements separated by
posixpath.sep, generate all elements of that path
>>> list(_ancestry('b/d'))
['b/d', 'b']
>>> list(_ancestry('/b/d/'))
['/b/d', '/b']
>>> list(_ancestry('b/d/f/'))
['b/d/f', 'b/d', 'b']
>>> list(_ancestry('b'))
['b']
>>> list(_ancestry(''))
[]
N)rstrip posixpathsepsplit)r
tails r r r % sS ;;y}}%D
49==(
__T*
49==($($s A2A:6A:c V [ R " [ U5 R U 5 $ )zN
Return items in minuend not in subtrahend, retaining order
with O(1) lookup.
)r filterfalseset__contains__)minuend
subtrahends r _differencer ? s!
Z!=!=wGGr c X ^ \ rS rSrSr\S 5 rU 4S jrS rS r \
S 5 rSrU =r
$ ) CompleteDirsG z_
A ZipFile subclass that ensures that implied directories
are always included in the namelist.
c [ R R [ [ U 5 5 nS U 5 n[ [
X 5 5 $ )Nc 3 F # U H o[ R - v M g 7fN)r r ).0ps r -CompleteDirs._implied_dirs..P s 6gy}}$gs !)r chain
from_iterablemapr _deduper )namesparentsas_dirss r
_implied_dirsCompleteDirs._implied_dirsM s7 ////He0DE6g6{7233r c b > [ [ U ] 5 nU[ U R U5 5 - $ r# )superr namelistlistr/ )selfr, __class__s r r3 CompleteDirs.namelistS s- lD24tD..u5666r c 4 [ U R 5 5 $ r# )r r3 r5 s r _name_setCompleteDirs._name_setW s 4==?##r c ` U R 5 nUS- nX; =( a X2; nU( a U$ U$ )z`
If the name represents a directory, return that name
as a directory (with the trailing slash).
/)r: )r5 namer, dirname dir_matchs r resolve_dirCompleteDirs.resolve_dirZ s6
*%:'*: #w--r c [ U[ 5 ( a U$ [ U[ R 5 ( d U " [ U5 5 $ SUR
; a [ n Xl U$ )zT
Given a source (filename or zipfile), return an
appropriate CompleteDirs subclass.
r)
isinstancer zipfileZipFile_pathlib_compatmoder6 )clssources r makeCompleteDirs.maked sU fl++M&'//22v.// fkk!C
r )__name__
__module____qualname____firstlineno____doc__staticmethodr/ r3 r: rA classmethodrL __static_attributes__
__classcell__r6 s @r r r G s?
4 4
7$. r r c 8 ^ \ rS rSrSrU 4S jrU 4S jrSrU =r$ )
FastLookupx zJ
ZipFile subclass to ensure implicit
dirs exist and are resolved rapidly.
c > [ R " [ 5 U R sS S S 5 $ ! , ( d f O= f[ [
U ] 5 U l U R $ r# )
contextlibsuppressAttributeError_FastLookup__namesr2 rZ r3 r5 r6 s r r3 FastLookup.namelist~ s?
0<< 1
0
0Z79|| 2
A c > [ R " [ 5 U R sS S S 5 $ ! , ( d f O= f[ [
U ] 5 U l U R $ r# )r] r^ r_ _FastLookup__lookupr2 rZ r: ra s r r: FastLookup._name_set s?
0== 1
0
0j$9;
}}rc )__lookup__names) rO rP rQ rR rS r3 r: rV rW rX s @r rZ rZ x s
r rZ c Z U R 5 $ ! [ a [ U 5 s $ f = f)z]
For path-like objects, convert to a filename for compatibility
on Python 3.6.1 and earlier.
)
__fspath__r_ strr s r rH rH s-
4ys **c \ rS rSrSrSrSS jrSSS.S jjr\S 5 r \S 5 r
\S
5 r\S 5 r\S 5 r
S
rS rS rS rS rS rS rS rS rS rS r\r\S 5 rSrg)r uX
A pathlib-compatible interface for zip files.
Consider a zip file with this structure::
.
├── a.txt
└── b
├── c.txt
└── d
└── e.txt
>>> data = io.BytesIO()
>>> zf = zipfile.ZipFile(data, 'w')
>>> zf.writestr('a.txt', 'content of a')
>>> zf.writestr('b/c.txt', 'content of c')
>>> zf.writestr('b/d/e.txt', 'content of e')
>>> zf.filename = 'mem/abcde.zip'
Path accepts the zipfile object itself or a filename
>>> root = Path(zf)
From there, several path operations are available.
Directory iteration (including the zip file itself):
>>> a, b = root.iterdir()
>>> a
Path('mem/abcde.zip', 'a.txt')
>>> b
Path('mem/abcde.zip', 'b/')
name property:
>>> b.name
'b'
join with divide operator:
>>> c = b / 'c.txt'
>>> c
Path('mem/abcde.zip', 'b/c.txt')
>>> c.name
'c.txt'
Read text:
>>> c.read_text()
'content of c'
existence:
>>> c.exists()
True
>>> (b / 'missing.txt').exists()
False
Coercion to string:
>>> import os
>>> str(c).replace(os.sep, posixpath.sep)
'mem/abcde.zip/b/c.txt'
At the root, ``name``, ``filename``, and ``parent``
resolve to the zipfile. Note these attributes are not
valid and will raise a ``ValueError`` if the zipfile
has no filename.
>>> root.name
'abcde.zip'
>>> str(root.filename).replace(os.sep, posixpath.sep)
'mem/abcde.zip'
>>> str(root.parent)
'mem'
z>{self.__class__.__name__}({self.root.filename!r}, {self.at!r})c D [ R U5 U l X l g)a
Construct a Path from a ZipFile or filename.
Note: When the source is an existing ZipFile object,
its type (__class__) will be mutated to a
specialized type. If the caller wishes to retain the
original type, the caller should either create a
separate ZipFile object or pass a filename.
N)rZ rL rootat)r5 ro rp s r __init__
Path.__init__ s OOD) r Npwdc V U R 5 ( a [ U 5 eUS nU R 5 ( d US:X a [ U 5 eU R R U R XRS9nSU; a U( d U( a [ S5 eU$ [ R " U/UQ70 UD6$ )z
Open this entry as text or binary following the semantics
of ``pathlib.Path.open()`` by passing arguments through
to io.TextIOWrapper().
r rD rs bz*encoding args invalid for binary operation)
is_dirIsADirectoryErrorexistsFileNotFoundErrorro openrp
ValueErrorio
TextIOWrapper)r5 rI rt argskwargszip_modestreams r r{ Path.open s ;;==#D))7{{}}S#D));$;v !MNNM8888r c [ R " U R 5 R =( d U R R $ r# )pathlibr rp r> filenamer9 s r r> Path.name * ||DGG$))?T]]-?-??r c [ R " U R 5 R =( d U R R $ r# )r r rp suffixr r9 s r r Path.suffix s* ||DGG$++Ct}}/C/CCr c [ R " U R 5 R =( d U R R $ r# )r r rp suffixesr r9 s r r
Path.suffixes
s* ||DGG$--G1G1GGr c [ R " U R 5 R =( d U R R $ r# )r r rp stemr r9 s r r Path.stem r r c [ R " U R R 5 R U R
5 $ r# )r r ro r joinpathrp r9 s r r
Path.filename s* ||DII../88AAr c U R " S/UQ70 UD6 nUR 5 sS S S 5 $ ! , ( d f g = f)NrD r{ read)r5 r r strms r read_textPath.read_text s/
YYs
,T
,V
,99; -
,
,s 1
?c z U R S5 nUR 5 sS S S 5 $ ! , ( d f g = f)Nrbr )r5 r s r
read_bytesPath.read_bytes s"
YYt_99; __s ,
:c [ R " UR R S5 5 U R R S5 :H $ Nr= )r r? rp r )r5 r
s r _is_childPath._is_child! s2 !459LLLr c : U R U R U5 $ r# )r6 ro )r5 rp s r _next
Path._next$ s ~~dii,,r c h U R ( + =( d U R R S5 $ r )rp endswithr9 s r rw Path.is_dir' s" 77{3dgg..s33r c Z U R 5 =( a U R 5 ( + $ r# )ry rw r9 s r is_filePath.is_file* s {{}2T[[]!22r c P U R U R R 5 ; $ r# )rp ro r: r9 s r ry Path.exists- s ww$))--///r c U R 5 ( d [ S5 e[ U R U R R 5 5 n[
U R U5 $ )NzCan't listdir a file)rw r| r* r ro r3 filterr )r5 subss r iterdirPath.iterdir0 sG {{}}3444::tyy1134dnnd++r c l [ R " U R R U R 5 $ r# )r joinro r rp r9 s r __str__Path.__str__6 s! ~~dii00$''::r c 4 U R R U S9$ )Nr9 )_Path__reprformatr9 s r __repr__
Path.__repr__9 s {{!!t!,,r c [ R " U R /[ [ U5 Q76 nU R U R R U5 5 $ r# )r r rp r* rH r ro rA )r5 othernexts r r
Path.joinpath< s> ~~dggDOU(CDzz$))//566r c U R ( d U R R $ [ R " U R R S5 5 nU( a US-
nU R
U5 $ r )rp r parentr r? r r )r5 parent_ats r r Path.parentB sR ww=='''%%dggnnS&9: Izz)$$r )rp ro ) )rD )rO rP rQ rR rS r rq r{ propertyr> r r r r r r r r rw r ry r r r r __truediv__r rV rN r r r r s KZ NF9 9$ @ @ D D H H @ @ B BM-430,;-7 K
% %r )r} r rF r r] sysr version_infocollectionsr dict__all__r r fromkeysr+ r rG r rZ rH r rN r r r s
f'K (6&+,
/H.7?? .b &s% s%r