%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /lib/python3/dist-packages/twisted/python/__pycache__/
Upload File :
Create Path :
Current File : //lib/python3/dist-packages/twisted/python/__pycache__/urlpath.cpython-312.pyc

�

Ϫ�f� ����dZddlmZddlmZmZmZddl	m
Zdje
dd�D�cgc]}e|�jd���c}�Zd	�ZGd
�d�Zycc}w)
z(
L{URLPath}, a representation of a URL.
�)�cast)�quote�unquote�
urlunsplit)�URL����asciic�2��d|z�t�fd��fd��S)a
    Attriute declaration to preserve mutability on L{URLPath}.

    @param name: a public attribute name
    @type name: native L{str}

    @return: a descriptor which retrieves the private version of the attribute
        on get and calls rerealize on set.
    �_c���t|��S�N)�getattr)�self�privateNames ��8/usr/lib/python3/dist-packages/twisted/python/urlpath.py�<lambda>z"_rereconstituter.<locals>.<lambda>s���W�T�;�/�rc���t|�t|t�r|n|jd��xs|j	�S)N�charmap)�setattr�
isinstance�bytes�encode�
_reconstitute)r�valuers  �rrz"_rereconstituter.<locals>.<lambda>s@������#�E�5�1��u�|�|�I�7N�
�
$�
�!�!�#�
r)�property)�namers @r�_rereconstituterrs#�����*�K��/�	
�
�
rc��eZdZdZ	dd�Zd�Zed�Zed�Zed�Z	ed�Z
ed�Zed	��Z
dd
�Zed��Zed��Zed
��Zd�Zdd�Zdd�Zdd�Zdd�Zd�Zdefd�Zdefd�Zy)�URLPatha�
    A representation of a URL.

    @ivar scheme: The scheme of the URL (e.g. 'http').
    @type scheme: L{bytes}

    @ivar netloc: The network location ("host").
    @type netloc: L{bytes}

    @ivar path: The path on the network location.
    @type path: L{bytes}

    @ivar query: The query argument (the portion after ?  in the URL).
    @type query: L{bytes}

    @ivar fragment: The page fragment (the portion after # in the URL).
    @type fragment: L{bytes}
    c�z�|xsd|_||_|xsd|_||_||_|j�y)Nshttp�/)�_scheme�_netloc�_path�_query�	_fragmentr)r�scheme�netloc�path�query�fragments      r�__init__zURLPath.__init__=s<���(��������\�T��
����!������rc	��tt|j|j|j|j
|jf�t��}tj|jd�jd��|_y)zM
        Reconstitute this L{URLPath} from all its given attributes.
        ��saferN)
�urlquoterr$r%r&r'r(�	_allascii�_URL�fromTextr�decode�_url)r�urltexts  rrzURLPath._reconstituteGsc�������t�|�|�T�Z�Z����d�n�n�U�
��	
���M�M�'�.�.��"9�"@�"@��"I�J��	rr)r*r+r,r-c��|j|�}|j|jxsdg��|_|jjjd�|_|jj�jd�|_t|jjd��j�j�jd�|_t|jj��j�j�jd�dd|_|jjjd�|_|S)	a
        Reconstruct all the public instance variables of this L{URLPath} from
        its underlying L{_URL}.

        @param urlInstance: the object to base this L{URLPath} on.
        @type urlInstance: L{_URL}

        @return: a new L{URLPath}
        �)r+rT)r+�rooted)r,r	N)�__new__�replacer+r7r)rr$�	authorityr%r4�asURI�asTextr&r,r'r-r()�cls�urlInstancers   r�_fromURLzURLPath._fromURLYs���{�{�3����'�'�[�-=�-=�-E�"��'�F��	��y�y�'�'�.�.�w�7����y�y�*�*�,�3�3�G�<����d�i�i�n�n�T�2�8�8�:�A�A�C�J�J�7�S�	
�
��$�)�)�/�/�2�8�8�:�A�A�C�J�J�7�S�UV�UW�X������+�+�2�2�7�;����rc��|jj}d�}|r|fd�}dg|D�cgc]
}||���c}zScc}w)a
        Split this URL's path into its components.

        @param unquote: whether to remove %-encoding from the returned strings.

        @param copy: (ignored, do not use)

        @return: The components of C{self.path}
        @rtype: L{list} of L{bytes}
        c�$�|jd�S)Nr)r��xs rrz"URLPath.pathList.<locals>.<lambda>{s��1�8�8�G�,�rc�$�|t|��Sr)�
urlunquote)rG�ms  rrz"URLPath.pathList.<locals>.<lambda>}s���:�a�=�)9�rr)r7r+)rr�copy�segments�mapper�segments      r�pathListzURLPath.pathListos@���9�9�>�>��,���!'�9�F��u�x�@�G��w��@�@�@��@s�;c��t|t�std��|jt	j
|��S)z�
        Make a L{URLPath} from a L{str} or L{unicode}.

        @param url: A L{str} representation of a URL.
        @type url: L{str} or L{unicode}.

        @return: a new L{URLPath} derived from the given string.
        @rtype: L{URLPath}
        z'url' must be a str)r�str�
ValueErrorrCr4r5)�klass�urls  r�
fromStringzURLPath.fromString�s2���#�s�#��2�3�3��~�~�d�m�m�C�0�1�1rc�|�t|t�std��t|t��}|j|�S)z�
        Make a L{URLPath} from a L{bytes}.

        @param url: A L{bytes} representation of a URL.
        @type url: L{bytes}

        @return: a new L{URLPath} derived from the given L{bytes}.
        @rtype: L{URLPath}

        @since: 15.4
        z'url' must be bytesr0)rrrRr2r3rU)rSrT�quoteds   r�	fromByteszURLPath.fromBytes�s7���#�u�%��2�3�3��#�I�.������'�'rc�@�|j|j��S)a
        Make a L{URLPath} from a L{twisted.web.http.Request}.

        @param request: A L{twisted.web.http.Request} to make the L{URLPath}
            from.

        @return: a new L{URLPath} derived from the given request.
        @rtype: L{URLPath}
        )rX�
prePathURL)rS�requests  r�fromRequestzURLPath.fromRequest�s�����w�1�1�3�4�4rc��|j|jd|r|jj���Sd���S)a�
        Return a modified copy of C{self} using C{newURL}, keeping the query
        string if C{keepQuery} is C{True}.

        @param newURL: a L{URL} to derive a new L{URLPath} from
        @type newURL: L{URL}

        @param keepQuery: if C{True}, preserve the query parameters from
            C{self} on the new L{URLPath}; if C{False}, give the new L{URLPath}
            no query parameters.
        @type keepQuery: L{bool}

        @return: a new L{URLPath}
        r:�)r-r,)rCr=r7r,)r�newURL�	keepQuerys   r�_modzURLPath._mod�sA���}�}��N�N�B��d�i�i�o�o�N�S�
�	
�PR�N�S�
�	
rc�v�|j|jj|jd��|�S)a�
        Get the sibling of the current L{URLPath}.  A sibling is a file which
        is in the same directory as the current file.

        @param path: The path of the sibling.
        @type path: L{bytes}

        @param keepQuery: Whether to keep the query parameters on the returned
            L{URLPath}.
        @type keepQuery: L{bool}

        @return: a new L{URLPath}
        r)rar7�siblingr6�rr+r`s   rrczURLPath.sibling�s-���y�y����*�*�4�;�;�w�+?�@�)�L�Lrc�v�|j|jj|jd��|�S)a)
        Get the child of this L{URLPath}.

        @param path: The path of the child.
        @type path: L{bytes}

        @param keepQuery: Whether to keep the query parameters on the returned
            L{URLPath}.
        @type keepQuery: L{bool}

        @return: a new L{URLPath}
        r)rar7�childr6rds   rrfz
URLPath.child�s+���y�y���������W�)=�>�	�J�Jrc�X�|j|jjd�|�S)z�
        Get the parent directory of this L{URLPath}.

        @param keepQuery: Whether to keep the query parameters on the returned
            L{URLPath}.
        @type keepQuery: L{bool}

        @return: a new L{URLPath}
        z..�rar7�click�rr`s  r�parentzURLPath.parent�s"���y�y�������.�	�:�:rc�X�|j|jjd�|�S)z�
        Get the current directory of this L{URLPath}.

        @param keepQuery: Whether to keep the query parameters on the returned
            L{URLPath}.
        @type keepQuery: L{bool}

        @return: a new L{URLPath}
        �.rhrjs  r�herezURLPath.here�s"���y�y�������-�y�9�9rc�t�|j|jj|jd���S)a7
        Return a path which is the URL where a browser would presumably take
        you if you clicked on a link with an HREF as given.

        @param st: A relative URL, to be interpreted relative to C{self} as the
            base URL.
        @type st: L{bytes}

        @return: a new L{URLPath}
        r)rCr7rir6)r�sts  rriz
URLPath.click�s)���}�}�T�Y�Y�_�_�R�Y�Y�w�-?�@�A�Ar�returnc�n�tt|jj�j	��S)z=
        The L{str} of a L{URLPath} is its URL text.
        )rrQr7r?r@�rs r�__str__zURLPath.__str__s%���C������*�1�1�3�4�4rc��dj|j|j|j|j|j
�S)z{
        The L{repr} of a L{URLPath} is an eval-able expression which will
        construct a similar L{URLPath}.
        zGURLPath(scheme={!r}, netloc={!r}, path={!r}, query={!r}, fragment={!r}))�formatr)r*r+r,r-rss r�__repr__zURLPath.__repr__s;��
Y�_�_��K�K��K�K��I�I��J�J��M�M�
�	
rN)rs	localhostrrr)FT)F)�__name__�
__module__�__qualname__�__doc__r.rrr)r*r+r,r-�classmethodrCrOrUrXr\rarcrfrkrnrirQrtrwr^rrr!r!)s����(NQ��
K��h�
'�F�
�h�
'�F��F�#�D��W�%�E��
�+�H�����*A�"�2��2��(��(�"�
5��
5�
�&M� 
K�
;�
:�B�5��5�
�#�
rr!N)r{�typingr�urllib.parserr2rrIr�	hyperlinkrr4�join�range�chrrr3rr!rFs0r�<module>r�s[��
��M�M�!��H�H�e�A�s�m�D��c�!�f�m�m�G�,�D�E�	��0m
�m
��7Es�A"

Zerion Mini Shell 1.0