https://t.me/RX1948
Server : Apache
System : Linux iad1-shared-b8-43 6.6.49-grsec-jammy+ #10 SMP Thu Sep 12 23:23:08 UTC 2024 x86_64
User : dh_edsupp ( 6597262)
PHP Version : 8.2.26
Disable Function : NONE
Directory :  /lib/python3/dist-packages/distlib/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //lib/python3/dist-packages/distlib/__pycache__/manifest.cpython-310.pyc
o

2Q�\�9�@s�dZddlZddlZddlZddlZddlZddlmZddlm	Z	ddl
mZdgZe�
e�Ze�dej�Ze�d	ejejB�Zejdd
�ZGdd�de�ZdS)zu
Class representing the list of files in a distribution.

Equivalent to distutils.filelist, but fixes some problems.
�N�)�DistlibException)�fsdecode��convert_path�Manifestz\\w*
z#.*?(?=
)|
(?=$)�c@s�eZdZdZddd�Zdd�Zdd�Zd	d
�Zddd
�Zdd�Z	dd�Z
dd�Z		ddd�Z		ddd�Z
		ddd�Zdd�ZdS) rz~A list of files built by on exploring the filesystem and filtered by
    applying various patterns to what we find there.
    NcCs>tj�tj�|pt����|_|jtj|_d|_t	�|_
dS)zd
        Initialise an instance.

        :param base: The base directory to explore under.
        N)�os�path�abspath�normpath�getcwd�base�sep�prefix�allfiles�set�files)�selfr�r�2/usr/lib/python3/dist-packages/distlib/manifest.py�__init__*szManifest.__init__cCs�ddlm}m}m}g|_}|j}|g}|j}|j}|rU|�}t�	|�}	|	D])}
tj
�||
�}t�|�}|j}
||
�rD|�t
|��q'||
�rP||
�sP||�q'|sdSdS)zmFind all files under the base and set ``allfiles`` to the absolute
        pathnames of files found.
        r)�S_ISREG�S_ISDIR�S_ISLNKN)�statrrrrr�pop�appendr	�listdirr
�join�st_moder)rrrrr�root�stackr�push�names�name�fullnamer�moderrr�findall9s&


��zManifest.findallcCs4|�|j�stj�|j|�}|j�tj�|��dS)zz
        Add a file to the manifest.

        :param item: The pathname to add. This can be relative to the base.
        N)	�
startswithrr	r
rrr�addr)r�itemrrrr*TszManifest.addcCs|D]}|�|�qdS)z�
        Add a list of files to the manifest.

        :param items: The pathnames to add. These can be relative to the base.
        N)r*)r�itemsr+rrr�add_many^s�zManifest.add_manyFcsb��fdd��t�j�}|r#t�}|D]}�|tj�|��q||O}dd�tdd�|D��D�S)z8
        Return sorted files in directory order
        csN|�|�t�d|�|�jkr%tj�|�\}}|dvsJ��||�dSdS)Nzadd_dir added %s)��/)r*�logger�debugrr	r
�split)�dirs�d�parent�_��add_dirrrrr8ls

�z Manifest.sorted.<locals>.add_dircSsg|]}tjj|��qSr)r	r
r)�.0�
path_tuplerrr�
<listcomp>zsz#Manifest.sorted.<locals>.<listcomp>css�|]	}tj�|�VqdS�N)r	r
r2)r9r
rrr�	<genexpr>{s�z"Manifest.sorted.<locals>.<genexpr>)rrr	r
�dirname�sorted)r�wantdirs�resultr3�frr7rr?gs
�zManifest.sortedcCst�|_g|_dS)zClear all collected files.N)rrr)rrrr�clear}s
zManifest.clearcCsp|�|�\}}}}|dkr!|D]}|j|dd�st�d|�qdS|dkr3|D]	}|j|dd�}q'dS|dkrK|D]}|j|dd�sHt�d|�q9dS|d	kr]|D]	}|j|dd�}qQdS|d
krv|D]}|j||d�sst�d||�qcdS|d
kr�|D]	}|j||d�}q|dS|dkr�|jd|d�s�t�d|�dSdS|dkr�|jd|d�s�t�d|�dSdStd|��)av
        Process a directive which either adds some files from ``allfiles`` to
        ``files``, or removes some files from ``files``.

        :param directive: The directive to process. This should be in a format
                     compatible with distutils ``MANIFEST.in`` files:

                     http://docs.python.org/distutils/sourcedist.html#commands
        �includeT)�anchorzno files found matching %r�exclude�global-includeFz3no files found matching %r anywhere in distribution�global-exclude�recursive-include)rz-no files found matching %r under directory %r�recursive-exclude�graftNz no directories found matching %r�prunez4no previously-included directories found matching %rzinvalid action %r)�_parse_directive�_include_patternr0�warning�_exclude_patternr)r�	directive�action�patterns�thedir�
dirpattern�pattern�foundrrr�process_directive�sd����������������zManifest.process_directivecCs|��}t|�dkr|ddvr|�dd�|d}d}}}|dvr<t|�dkr0td|��d	d
�|dd�D�}n?|dvr^t|�dkrLtd
|��t|d�}dd
�|dd�D�}n|dvrut|�dkrntd|��t|d�}ntd|��||||fS)z�
        Validate a directive.
        :param directive: The directive to validate.
        :return: A tuple of action, patterns, thedir, dir_patterns
        rr)rDrFrGrHrIrJrKrLrDN)rDrFrGrHrz$%r expects <pattern1> <pattern2> ...cS�g|]}t|��qSrr�r9�wordrrrr;��z-Manifest._parse_directive.<locals>.<listcomp>)rIrJ�z*%r expects <dir> <pattern1> <pattern2> ...cSrYrrrZrrrr;�r\)rKrLz!%r expects a single <dir_pattern>zunknown action %r)r2�len�insertrr)rrQ�wordsrRrSrT�dir_patternrrrrM�s4���zManifest._parse_directiveTcCsPd}|�||||�}|jdur|��|jD]}|�|�r%|j�|�d}q|S)a�Select strings (presumably filenames) from 'self.files' that
        match 'pattern', a Unix-style wildcard (glob) pattern.

        Patterns are not quite the same as implemented by the 'fnmatch'
        module: '*' and '?'  match non-special characters, where "special"
        is platform-dependent: slash on Unix; colon, slash, and backslash on
        DOS/Windows; and colon on Mac OS.

        If 'anchor' is true (the default), then the pattern match is more
        stringent: "*.py" will match "foo.py" but not "foo/bar.py".  If
        'anchor' is false, both of these will match.

        If 'prefix' is supplied, then only filenames starting with 'prefix'
        (itself a pattern) and ending with 'pattern', with anything in between
        them, will match.  'anchor' is ignored in this case.

        If 'is_regex' is true, 'anchor' and 'prefix' are ignored, and
        'pattern' is assumed to be either a string containing a regex or a
        regex object -- no translation is done, the regex is just compiled
        and used as-is.

        Selected strings will be added to self.files.

        Return True if files are found.
        FNT)�_translate_patternrr(�searchrr*)rrVrEr�is_regexrW�
pattern_rer%rrrrNs


�zManifest._include_patterncCsBd}|�||||�}t|j�D]}|�|�r|j�|�d}q|S)atRemove strings (presumably filenames) from 'files' that match
        'pattern'.

        Other parameters are the same as for 'include_pattern()', above.
        The list 'self.files' is modified in place. Return True if files are
        found.

        This API is public to allow e.g. exclusion of SCM subdirs, e.g. when
        packaging source distributions
        FT)rb�listrrc�remove)rrVrErrdrWrerBrrrrP)s
�zManifest._exclude_patternc
Cs�|rt|t�rt�|�S|Stdkr|�d��d�\}}}|r5|�|�}tdkr4|�|�r2|�|�s4J�nd}t�	t
j�|j
d��}	|dur�tdkr\|�d�}
|�|�dt|
��}n|�|�}|�|�rk|�|�smJ�|t|�t|�t|��}t
j}t
jdkr�d}tdkr�d|	|�|d|f�}n3|t|�t|�t|��}d	||	||||f}n|r�tdkr�d|	|}n
d
||	|t|�d�f}t�|�S)aTranslate a shell-like wildcard pattern to a compiled regular
        expression.

        Return the compiled regex.  If 'is_regex' true,
        then 'pattern' is directly compiled to a regex (if it's a string)
        or just returned as-is (assumes it's a regex object).
        )r]rr6r.N�\z\\�^z.*z%s%s%s%s.*%s%sz%s%s%s)�
isinstance�str�re�compile�_PYTHON_VERSION�_glob_to_re�	partitionr)�endswith�escaper	r
rrr^r)
rrVrErrd�startr6�endrer�
empty_pattern�	prefix_rerrrrrb=sH	


�



�
�
zManifest._translate_patterncCs8t�|�}tj}tjdkrd}d|}t�d||�}|S)z�Translate a shell-like glob pattern to a regular expression.

        Return a string containing the regex.  Differs from
        'fnmatch.translate()' in that '*' does not match "special characters"
        (which are platform-specific).
        rhz\\\\z\1[^%s]z((?<!\\)(\\\\)*)\.)�fnmatch�	translater	rrl�sub)rrVrer�escapedrrrrots

zManifest._glob_to_rer<)F)TNF)�__name__�
__module__�__qualname__�__doc__rr(r*r-r?rCrXrMrNrPrbrorrrrr%s(


	O/
�)
�
�7)r~rw�loggingr	rl�sysr.r�compatr�utilr�__all__�	getLoggerr{r0rm�M�_COLLAPSE_PATTERN�S�_COMMENTED_LINE�version_inforn�objectrrrrr�<module>s


https://t.me/RX1948 - 2025