CasperSecurity

Current Path : /lib/python3/dist-packages/jsonschema/__pycache__/
Upload File :
Current File : //lib/python3/dist-packages/jsonschema/__pycache__/_utils.cpython-310.pyc

o

>��]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)r�geturl��self�uri�r�3/usr/lib/python3/dist-packages/jsonschema/_utils.py�	normalizeszURIDict.normalizecOst�|_|jj|i|��dSr)�dict�store�update)r	�args�kwargsrrr�__init__szURIDict.__init__cCs|j|�|�Sr�rr
rrrr�__getitem__szURIDict.__getitem__cCs||j|�|�<dSrr)r	r
�valuerrr�__setitem__szURIDict.__setitem__cCs|j|�|�=dSrrrrrr�__delitem__szURIDict.__delitem__cC�
t|j�Sr)�iterr�r	rrr�__iter__�
zURIDict.__iter__cCrr)�lenrrrrr�__len__!rzURIDict.__len__cCrr)�reprrrrrr�__repr__$rzURIDict.__repr__N)�__name__�
__module__�__qualname__�__doc__r
rrrrrrr!rrrrr	src@seZdZdZdd�ZdS)�UnsetzG
    An as-of-yet unset attribute or unprovided default parameter.
    cCsdS)Nz<unset>rrrrrr!-szUnset.__repr__N)r"r#r$r%r!rrrrr&(sr&cCs"t�dd�|��}t�|�d��S)zC
    Load a schema from ./schemas/``name``.json and return it.
    �
jsonschemazschemas/{0}.jsonzutf-8)�pkgutil�get_data�format�json�loads�decode)�name�datarrr�load_schema1sr0�csd��fdd�|��D��S)z>
    A dumb version of `textwrap.indent` from Python 3.3.
    �
c3s �|]}dd�|VqdS)� �Nr)�.0�line��timesrr�	<genexpr>?s�zindent.<locals>.<genexpr>)�join�
splitlines)�stringr8rr7r�indent:sr=cCs |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][cs��|]}t|�VqdSr�r )r5�indexrrrr9Q��z"format_as_index.<locals>.<genexpr>)r:)�indicesrrr�format_as_indexBs
rDccsN�|�di�}d�|�di��}|D]}||vr$|r!t�||�r!q|VqdS)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�schemarE�patterns�propertyrrr�find_additional_propertiesTs�
��rOcCs.t|�dkr	d}nd}d�dd�|D��|fS)z@
    Create an error message for extra items or properties.
    r1�was�were�, csr?rr@)r5�extrarrrr9prBzextras_msg.<locals>.<genexpr>)rr:)�extras�verbrrr�
extras_msggsrVc	CsVg}|D]}z|�t|d��Wqty!|�t|��Yqwd|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 %srR)�appendr �	Exceptionr:)rK�types�reprs�typerrr�	types_msgss
�r\cCsLt�}t|t�s|f}|D]}t|t�r|�t|��q
|�|�q
t|�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)�suitable_for_isinstancerY�thingrrrr`�s


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

    Otherwise, return it unchanged.
    )r^r)rcrrr�ensure_list�s
rdcCst|�t|�kS)zQ
    Check if two things are equal, but evade booleans and ints being equal.
    ��unbool)�one�tworrr�equal�sricCs|dur|S|dur|S|S)zH
    A hack to make True and 1 and False and 0 unique for ``uniq``.
    TFr)�element�true�falserrrrf�s
rfcCs�zttdd�|D���t|�kWStyez'tdd�|D��}t�|dd�}t||�D]
\}}||kr:WYdSq-WYdSttfydg}|D]}t|�}||vrZYYdS|�	|�qKYYdSww)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.
    csr?rre�r5�irrrr9�rBzuniq.<locals>.<genexpr>csr?rrermrrrr9�rBr1NFT)
rr]�	TypeError�sorted�	itertools�islice�zip�NotImplementedErrorrfrW)�	container�sort�slicedrn�j�seen�errr�uniq�s.	 
��
�
���r{)r1)rqr+r(rI�jsonschema.compatrrrr�objectr&r0r=rDrOrVr\r`rdrirfr{rrrr�<module>s$	
	
Hacker Blog, Shell İndir, Sql İnjection, XSS Attacks, LFI Attacks, Social Hacking, Exploit Bot, Proxy Tools, Web Shell, PHP Shell, Alfa Shell İndir, Hacking Training Set, DDoS Script, Denial Of Service, Botnet, RFI Attacks, Encryption
Telegram @BIBIL_0DAY