Why Gemfury? Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Debian packages RPM packages NuGet packages

Repository URL to install this package:

Details    
Size: Mime:
B

·¯i|‚¨ã@s´ddlZddlZddlZddlZddlZddlZddlZejdkrPddlm	Z	ne
Z	dgZdd„Zdd„Z
e	jZd	d
„ZGdd„dejƒZGd
d„deƒZdd„ZGdd„dƒZdS)éN)éé)ÚOrderedDictÚPathcCst t|ƒdd¡S)a2
    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)Ú	itertoolsÚisliceÚ	_ancestry)Úpath©rú‚/build/wlanpi-profiler-koocPu/wlanpi-profiler-1.0.8/debian/wlanpi-profiler/opt/wlanpi-profiler/lib/python3.7/site-packages/zipp.pyÚ_parentssr
ccs8| tj¡}x&|r2|tjkr2|Vt |¡\}}qWdS)aR
    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Ú	posixpathÚsepÚsplit)r
Útailrrrr	%sr	cCst t|ƒj|¡S)zZ
    Return items in minuend not in subtrahend, retaining order
    with O(1) lookup.
    )rÚfilterfalseÚsetÚ__contains__)ZminuendZ
subtrahendrrrÚ_difference?srcsHeZdZdZedd„ƒZ‡fdd„Zdd„Zdd	„Ze	d
d„ƒZ
‡ZS)ÚCompleteDirszk
    A ZipFile subclass that ensures that implied directories
    are always included in the namelist.
    cCs.tj tt|ƒ¡}dd„|Dƒ}tt||ƒƒS)Ncss|]}|tjVqdS)N)rr)Ú.0Úprrrú	<genexpr>Psz-CompleteDirs._implied_dirs.<locals>.<genexpr>)rÚchainÚ
from_iterableÚmapr
Ú_deduper)ÚnamesÚparentsZas_dirsrrrÚ
_implied_dirsMszCompleteDirs._implied_dirscs tt|ƒ ¡}|t| |¡ƒS)N)ÚsuperrÚnamelistÚlistr!)Úselfr)Ú	__class__rrr#SszCompleteDirs.namelistcCst| ¡ƒS)N)rr#)r%rrrÚ	_name_setWszCompleteDirs._name_setcCs,| ¡}|d}||ko||k}|r(|S|S)zx
        If the name represents a directory, return that name
        as a directory (with the trailing slash).
        ú/)r')r%ÚnamerÚdirnameZ	dir_matchrrrÚresolve_dirZszCompleteDirs.resolve_dircCs>t|tƒr|St|tjƒs&|t|ƒƒSd|jkr4t}||_|S)zl
        Given a source (filename or zipfile), return an
        appropriate CompleteDirs subclass.
        Úr)Ú
isinstancerÚzipfileÚZipFileÚ_pathlib_compatÚmoder&)ÚclsÚsourcerrrÚmakeds

zCompleteDirs.make)Ú__name__Ú
__module__Ú__qualname__Ú__doc__Ústaticmethodr!r#r'r+Úclassmethodr4Ú
__classcell__rr)r&rrGs
rcs,eZdZdZ‡fdd„Z‡fdd„Z‡ZS)Ú
FastLookupzV
    ZipFile subclass to ensure implicit
    dirs exist and are resolved rapidly.
    c	s.t t¡|jSQRXtt|ƒ ¡|_|jS)N)Ú
contextlibÚsuppressÚAttributeErrorZ_FastLookup__namesr"r<r#)r%)r&rrr#~szFastLookup.namelistc	s.t t¡|jSQRXtt|ƒ ¡|_|jS)N)r=r>r?Z_FastLookup__lookupr"r<r')r%)r&rrr'„szFastLookup._name_set)r5r6r7r8r#r'r;rr)r&rr<xsr<cCs&y| ¡Stk
r t|ƒSXdS)zi
    For path-like objects, convert to a filename for compatibility
    on Python 3.6.1 and earlier.
    N)Ú
__fspath__r?Ústr)r
rrrr0‹sr0c@sÒeZdZdZdZd-dd„Zd.ddœd	d
„Zedd„ƒZed
d„ƒZ	edd„ƒZ
edd„ƒZedd„ƒZdd„Z
dd„Zdd„Zdd„Zdd„Zdd „Zd!d"„Zd#d$„Zd%d&„Zd'd(„Zd)d*„ZeZed+d,„ƒZdS)/ru4
    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})ÚcCst |¡|_||_dS)aX
        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)r<r4ÚrootÚat)r%rCrDrrrÚ__init__æs
z
Path.__init__r,N)ÚpwdcOsr| ¡rt|ƒ‚|d}| ¡s0|dkr0t|ƒ‚|jj|j||d}d|kr`|sT|r\tdƒ‚|Stj	|f|ž|ŽS)zª
        Open this entry as text or binary following the semantics
        of ``pathlib.Path.open()`` by passing arguments through
        to io.TextIOWrapper().
        rr,)rFÚbz*encoding args invalid for binary operation)
Úis_dirÚIsADirectoryErrorÚexistsÚFileNotFoundErrorrCÚopenrDÚ
ValueErrorÚioÚ
TextIOWrapper)r%r1rFÚargsÚkwargsZzip_modeÚstreamrrrrLósz	Path.opencCst |j¡jp|jjS)N)ÚpathlibrrDr)Úfilename)r%rrrr)sz	Path.namecCst |j¡jp|jjS)N)rSrrDÚsuffixrT)r%rrrrU	szPath.suffixcCst |j¡jp|jjS)N)rSrrDÚsuffixesrT)r%rrrrV
sz
Path.suffixescCst |j¡jp|jjS)N)rSrrDÚstemrT)r%rrrrWsz	Path.stemcCst |jj¡ |j¡S)N)rSrrCrTÚjoinpathrD)r%rrrrTsz
Path.filenamec	Os$|jd|ž|Ž
}| ¡SQRXdS)Nr,)r,)rLÚread)r%rPrQÚstrmrrrÚ	read_textszPath.read_textc	Cs| d¡
}| ¡SQRXdS)NÚrb)rLrY)r%rZrrrÚ
read_bytesszPath.read_bytescCst |j d¡¡|j d¡kS)Nr()rr*rDr)r%r
rrrÚ	_is_child!szPath._is_childcCs| |j|¡S)N)r&rC)r%rDrrrÚ_next$sz
Path._nextcCs|jp|j d¡S)Nr()rDÚendswith)r%rrrrH'szPath.is_dircCs| ¡o| ¡S)N)rJrH)r%rrrÚis_file*szPath.is_filecCs|j|j ¡kS)N)rDrCr')r%rrrrJ-szPath.existscCs.| ¡stdƒ‚t|j|j ¡ƒ}t|j|ƒS)NzCan't listdir a file)rHrMrr_rCr#Úfilterr^)r%ÚsubsrrrÚiterdir0szPath.iterdircCst |jj|j¡S)N)rÚjoinrCrTrD)r%rrrÚ__str__6szPath.__str__cCs|jj|dS)N)r%)Ú_Path__reprÚformat)r%rrrÚ__repr__9sz
Path.__repr__cGs*tj|jftt|ƒžŽ}| |j |¡¡S)N)rrerDrr0r_rCr+)r%ÚotherÚnextrrrrX<sz
Path.joinpathcCs6|js|jjSt |j d¡¡}|r,|d7}| |¡S)Nr()rDrTÚparentrr*rr_)r%Z	parent_atrrrrlBszPath.parent)rB)r,)r5r6r7r8rgrErLÚpropertyr)rUrVrWrTr[r]r^r_rHrarJrdrfrirXÚ__truediv__rlrrrrr–s,L

)rNrr.rr=ÚsysrSÚversion_infoÚcollectionsrÚdictÚ__all__r
r	Úfromkeysrrr/rr<r0rrrrrÚ<module>s$
1