HEX
Server: Apache
System: Linux scp1.abinfocom.com 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64
User: confeduphaar (1010)
PHP: 8.1.33
Disabled: exec,passthru,shell_exec,system
Upload Files
File: //usr/lib/python3/dist-packages/jsonschema/__pycache__/_utils.cpython-38.pyc
U

>��]0�@s�ddlZddlZddlZddlZddlmZmZmZGdd�de�ZGdd�de	�Z
dd�Zdd
d�Zdd
�Z
dd�Zdd�Zdd�Zdd�Zdd�Zdd�Ze	�e	�fdd�Zdd�ZdS)�N)�MutableMapping�	str_types�urlsplitc@sPeZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dd�Z
dd�ZdS)�URIDictz8
    Dictionary which uses normalized URIs as keys.
    cCst|���S�N)rZgeturl��self�uri�r
�3/usr/lib/python3/dist-packages/jsonschema/_utils.py�	normalizeszURIDict.normalizecOst�|_|jj||�dSr)�dict�store�update)r�args�kwargsr
r
r�__init__szURIDict.__init__cCs|j|�|�Sr�rrrr
r
r�__getitem__szURIDict.__getitem__cCs||j|�|�<dSrr)rr	�valuer
r
r�__setitem__szURIDict.__setitem__cCs|j|�|�=dSrrrr
r
r�__delitem__szURIDict.__delitem__cCs
t|j�Sr)�iterr�rr
r
r�__iter__szURIDict.__iter__cCs
t|j�Sr)�lenrrr
r
r�__len__!szURIDict.__len__cCs
t|j�Sr)�reprrrr
r
r�__repr__$szURIDict.__repr__N)�__name__�
__module__�__qualname__�__doc__rrrrrrrrr
r
r
rr	src@seZdZdZdd�ZdS)�UnsetzG
    An as-of-yet unset attribute or unprovided default parameter.
    cCsdS)Nz<unset>r
rr
r
rr-szUnset.__repr__N)rr r!r"rr
r
r
rr#(sr#cCs"t�dd�|��}t�|�d��S)zC
    Load a schema from ./schemas/``name``.json and return it.
    Z
jsonschemazschemas/{0}.jsonzutf-8)�pkgutil�get_data�format�json�loads�decode)�name�datar
r
r�load_schema1sr,�csd��fdd�|��D��S)z>
    A dumb version of `textwrap.indent` from Python 3.3.
    �
c3s|]}dd�|VqdS)� �Nr
)�.0�line��timesr
r�	<genexpr>?szindent.<locals>.<genexpr>)�join�
splitlines)�stringr4r
r3r�indent:sr9cCs |sdSdd�dd�|D��S)z�
    Construct a single string containing indexing operations for the indices.

    For example, [1, 2, "foo"] -> [1][2]["foo"]

    Arguments:

        indices (sequence):

            The indices to format.
    �z[%s]z][css|]}t|�VqdSr�r)r1�indexr
r
rr5Qsz"format_as_index.<locals>.<genexpr>)r6)�indicesr
r
r�format_as_indexBs
r>ccsL|�di�}d�|�di��}|D]$}||kr"|r@t�||�r@q"|Vq"dS)z�
    Return the set of additional properties for the given ``instance``.

    Weeds out properties that should have been validated by ``properties`` and
    / or ``patternProperties``.

    Assumes ``instance`` is dict-like already.
    �
properties�|ZpatternPropertiesN)�getr6�re�search)�instanceZschemar?Zpatterns�propertyr
r
r�find_additional_propertiesTs
rFcCs.t|�dkrd}nd}d�dd�|D��|fS)z@
    Create an error message for extra items or properties.
    r-ZwasZwere�, css|]}t|�VqdSrr;)r1Zextrar
r
rr5pszextras_msg.<locals>.<genexpr>)rr6)ZextrasZverbr
r
r�
extras_msggsrHc	CsZg}|D]>}z|�t|d��Wqtk
rD|�t|��YqXqd|d�|�fS)a+
    Create an error message for a failure to match the given types.

    If the ``instance`` is an object and contains a ``name`` property, it will
    be considered to be a description of that object and used as its type.

    Otherwise the message is simply the reprs of the given ``types``.
    r*z%r is not of type %srG)�appendr�	Exceptionr6)rD�typesZreprs�typer
r
r�	types_msgss
rMcCsLt�}t|t�s|f}|D](}t|t�r8|�t|��q|�|�qt|�S)z�
    isinstance() can accept a bunch of really annoying different types:
        * a single type
        * a tuple of types
        * an arbitrary nested tree of tuples

    Return a flattened tuple of the given argument.
    )�set�
isinstance�tupler�flatten�add)Zsuitable_for_isinstancerK�thingr
r
rrQ�s


rQcCst|t�r|gS|S)z]
    Wrap ``thing`` in a list if it's a single str.

    Otherwise, return it unchanged.
    )rOr)rSr
r
r�ensure_list�s
rTcCst|�t|�kS)zQ
    Check if two things are equal, but evade booleans and ints being equal.
    ��unbool)ZoneZtwor
r
r�equal�srWcCs|dkr|S|dkr|S|S)zH
    A hack to make True and 1 and False and 0 unique for ``uniq``.
    TFr
)�element�trueZfalser
r
rrV�s
rVcCs�z ttdd�|D���t|�kWStk
r�zJtdd�|D��}t�|dd�}t||�D]\}}||kr\WYdSq\WnJttfk
r�g}|D](}t|�}||kr�YYdS|�	|�q�YnXYnXdS)z�
    Check if all of a container's elements are unique.

    Successively tries first to rely that the elements are hashable, then
    falls back on them being sortable, and finally falls back on brute
    force.
    css|]}t|�VqdSrrU�r1�ir
r
rr5�szuniq.<locals>.<genexpr>css|]}t|�VqdSrrUrZr
r
rr5�sr-NFT)
rrN�	TypeError�sorted�	itertools�islice�zip�NotImplementedErrorrVrI)Z	container�sortZslicedr[�j�seen�er
r
r�uniq�s"	 
rf)r-)r^r'r$rBZjsonschema.compatrrrr�objectr#r,r9r>rFrHrMrQrTrWrVrfr
r
r
r�<module>s"