| 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 : |
o
�6�\U � @ sJ d dl Z ddlmZ ddlmZ G dd� d�Zdd� Zd d
� Zdd� ZdS )
� N� )�error_caveat)�condition_with_prefixc @ sJ e Zd ZdZddd�Zdd� Zdd� Zd d
� Zdd� Zd
d� Z dd� Z
dS )� Namespacea Holds 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.
Nc C s0 i | _ |d ur|D ]}| �||| � q d S d S �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__c C s | � � �d�S )z[Returns the namespace representation as returned by serialize
:return: str
�utf-8)�serialize_text�decode)r r r r
�__str__ s zNamespace.__str__c C s | j |j kS r )r )r �otherr r r
�__eq__ s zNamespace.__eq__c C sd | j du st| j �dkrdS t�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 ! s zNamespace.serialize_textc C sR t |�std�||���t|�std�||���| j�|�du r'|| j|<