HEX
Server: Apache
System: Linux 185.122.168.184.host.secureserver.net 5.14.0-570.60.1.el9_6.x86_64 #1 SMP PREEMPT_DYNAMIC Wed Nov 5 05:00:59 EST 2025 x86_64
User: barbeatleanalyti (1024)
PHP: 8.1.33
Disabled: NONE
Upload Files
File: //var/opt/nydus/ops/jsonschema/__pycache__/_utils.cpython-39.pyc
a

�,�h�)�@s�ddlmZmZmZddlmZddlZddlZGdd�de�ZGdd�d�Z	dd	�Z
d
d�Zdd
�Zdd�Z
dd�Zdd�Zdd�Ze�e�fdd�Zdd�Zdd�Zdd�Zdd�ZdS) �)�Mapping�MutableMapping�Sequence)�urlsplitNc@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)r�geturl��self�uri�r�B/opt/nydus/tmp/pip-target-wkfpz8uv/lib/python/jsonschema/_utils.py�	normalizeszURIDict.normalizecOst�|_|jj|i|��dSr)�dict�store�update)r
�args�kwargsrrr
�__init__szURIDict.__init__cCs|j|�|�Sr�rrr	rrr
�__getitem__szURIDict.__getitem__cCs||j|�|�<dSrr)r
r�valuerrr
�__setitem__szURIDict.__setitem__cCs|j|�|�=dSrrr	rrr
�__delitem__szURIDict.__delitem__cCs
t|j�Sr)�iterr�r
r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__rrrrrrrr rrrr
rsrc@seZdZdZdd�ZdS)�UnsetzG
    An as-of-yet unset attribute or unprovided default parameter.
    cCsdS)Nz<unset>rrrrr
r +szUnset.__repr__N)r!r"r#r$r rrrr
r%&sr%cCs(|s|S|�dd�dd�|D���d�S)aB
    Construct a single string containing indexing operations for the indices.

    For example for a container ``bar``, [1, 2, "foo"] -> bar[1][2]["foo"]

    Arguments:

        container (str):

            A word to use for the thing being indexed

        indices (sequence):

            The indices to format.

    �[z][css|]}t|�VqdSr�r)�.0�indexrrr
�	<genexpr>B�z"format_as_index.<locals>.<genexpr>�])�join)�	container�indicesrrr
�format_as_index/sr0ccsL|�di�}d�|�di��}|D]$}||vr"|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�|�patternPropertiesN)�getr-�re�search)�instance�schemar1�patterns�propertyrrr
�find_additional_propertiesEs	r;cCs,t|�dkrdnd}d�dd�|D��|fS)z@
    Create an error message for extra items or properties.
    ��was�werez, css|]}t|�VqdSrr')r(�extrarrr
r*\r+zextras_msg.<locals>.<genexpr>)rr-)�extras�verbrrr
�
extras_msgWsrBcCst|t�r|gS|S)z]
    Wrap ``thing`` in a list if it's a single str.

    Otherwise, return it unchanged.
    )�
isinstance�str)�thingrrr
�ensure_list_s
rFcs.t|�t��krdSt�fdd�|��D��S)zI
    Check if two mappings are equal using the semantics of `equal`.
    Fc3s(|] \}}|�vot|�|�VqdSr��equal�r(�keyr��tworr
r*ps�z!_mapping_equal.<locals>.<genexpr>)r�all�items��onerLrrKr
�_mapping_equaljs
�rQcCs,t|�t|�krdStdd�t||�D��S)zJ
    Check if two sequences are equal using the semantics of `equal`.
    Fcss|]\}}t||�VqdSrrG)r(�i�jrrr
r*|r+z"_sequence_equal.<locals>.<genexpr>)rrM�ziprOrrr
�_sequence_equalvsrUcCst||urdSt|t�s t|t�r(||kSt|t�rFt|t�rFt||�St|t�rdt|t�rdt||�St|�t|�kS)z�
    Check if two things are equal evading some Python type hierarchy semantics.

    Specifically in JSON Schema, evade `bool` inheriting from `int`,
    recursing into sequences to do the same.
    T)rCrDrrUrrQ�unboolrOrrr
rHs

rHcCs|dur|S|dur|S|S)zH
    A hack to make True and 1 and False and 0 unique for ``uniq``.
    TFr)�element�true�falserrr
rV�s
rVc	Cs�zJtdd�|D��}t�|dd�}t||�D]\}}t||�r,WdSq,WnTttfy�g}|D]4}t|�}|D]}t||�rtYdSqt|�|�qdYn0dS)z�
    Check if all of a container's elements are unique.

    Tries to rely on the container being recursively sortable, or otherwise
    falls back on (slow) brute force.
    css|]}t|�VqdSr)rV)r(rRrrr
r*�r+zuniq.<locals>.<genexpr>r<NFT)	�sorted�	itertools�islicerTrH�NotImplementedError�	TypeErrorrV�append)r.�sort�slicedrRrS�seen�errr
�uniq�s

rdcCs�|�|d�rgSg}d|vr,ttt|���S|�d�}|durl|j�|�}|�t|j	|j
|jd�||j
��|�d�}|dur�|j�|�}|�t|j	|j
|jd�||j
��d|vr�|ttt|d���7}d|v�r@|j	|dd	��|��r"|t|||d�7}d
|v�r@|t|||d
�7}nd|v�r@|t|||d�7}dD]F}||v�rDt
|�D],\}}	|j	||d	��|	��rZ|�|��qZ�qDd
D]L}||v�r�||D]2}
t|�||
�d�}|du�r�|t|||
�7}�q��q�|S)z�
    Get all indexes of items that get evaluated under the current schema.

    Covers all keywords related to unevaluatedItems: items, prefixItems, if,
    then, else, contains, unevaluatedItems, allOf, oneOf, anyOf
    �booleanrN�$refN�r8�	_resolver�$dynamicRefZprefixItems�if�r8�then�else)�containsZunevaluatedItems�ZallOf�oneOfZanyOf)�is_type�list�rangerr4rh�lookup�extend�%find_evaluated_item_indexes_by_schema�evolve�contents�resolver�is_valid�	enumerater_�next�descend)�	validatorr7r8Zevaluated_indexes�ref�resolved�
dynamicRef�keyword�k�v�	subschemaZerrsrrr
rv�sx
���
���

�

�

�


�rvcs4��|d�rgSg}|�d�}|durT�j�|�}|�t�j|j|jd�||j��|�d�}|dur��j�|�}|�t�j|j|jd�||j��|�d�}��|d�r�||�	�|�	�@7}dD]4}|�|��dur�q�|��fd	d
�|�
�D�7}q�d|v�r6|D].}	|dD]}
t�|
|	��r|�
|	��q�qd|v�rv|d�
�D](\}	�|	|v�rb�qL|t�|��7}�qLd
D]@}|�|g�D],�t��|����s��q�|t�|��7}�q��qzd|v�r0�j|dd��|��r|t�||d�7}d|v�r0|t�||d�7}nd|v�r0|t�||d�7}|S)a
    Get all keys of items that get evaluated under the current schema.

    Covers all keywords related to unevaluatedProperties: properties,
    additionalProperties, unevaluatedProperties, patternProperties,
    dependentSchemas, allOf, oneOf, anyOf, if, then, else
    rerfNrgrir1�object)ZadditionalPropertiesZunevaluatedPropertiesc3s&|]\}}t��|���r|VqdSr)rzr}rI�r�r~rr
r*4s�z9find_evaluated_property_keys_by_schema.<locals>.<genexpr>r3ZdependentSchemasrorjrkrlrm)rqr4rhrtru�&find_evaluated_property_keys_by_schemarwrxry�keysrNr5r6r_rzr})r~r7r8Zevaluated_keysrr�r�r1r�r:�patternrr�r
r�s�
���
���
�



�
�

�

�

�r�cCst|d�duS)z2Whether there are no errors in the given iterator.N)r|)Zerrs_itrrr
rzasrz)�collections.abcrrr�urllib.parserr[r5rr%r0r;rBrFrQrUrHr�rVrdrvr�rzrrrr
�<module>s"		M\