[ Avaa Bypassed ]




Upload:

Command:

hmhc3928@13.59.88.8: ~ $
U

���`S�@s�dZddlmZddlmZmZddlmZmZddlm	Z	ddl
mZddlm
Z
mZddlmZmZed	d
�Zedd�Zedd�Zd
Zedd�Zedd�Zedd�Zedd�Zedd�Zedd�ZdZedd�Zedd�Zedd�Zedd�Zed d!�Zed"d#�Z ed$d%�Z!ed&d'�Z"ed(d)�Z#ed*d+�Z$ed,d-�Z%ed.d-�Z&ed/d0�Z'ed1d0�Z(ed2d3�Z)ed4d�Z*ed5d6�Z+ed7d8�Z,ed9d:�Z-ed;d<�Z.ed=d�Z/ed>d�Z0ed?d�Z1ed@dA�Z2Z3edBdC�Z4Z5edDd!�Z6edEd�Z7edFdG�Z8edHdI�Z9edJdK�Z:edLdM�Z;dNZ<dOZ=GdPdQ�dQe>�Z?GdRdS�dSe@�ZAGdTdU�dUe�ZBGdVdW�dWeB�ZCGdXdY�dYeC�ZDGdZd[�d[eC�ZEGd\d]�d]e>�ZFGd^d_�d_eF�ZGd`da�ZHGdbdc�dceF�ZIGddde�deeI�ZJdS)fz? This module contains the error-related constants and classes. �)�absolute_import)�defaultdict�
namedtuple)�copy�deepcopy)�wraps)�pformat)�PYTHON_VERSION�MutableMapping)�compare_paths_lt�quote_string�ErrorDefinitionz
code, ruleN��document is missing�Zrequired��Zdependencies��Zexcludes�!�''{0}' is not a document, must be a dict�"�empty�#Znullable�$�type�%�schema�&�items�'Z	minlength�(Z	maxlength�AZregex�B�min�C�max�DZallowed�E�FZ	forbidden�G�H�contains�`�aZcoerce�bZrename_handler�c�readonly�dZdefault_setter����Z	keysrules�Zvaluesrules���Znoneof�Zoneof�Zanyof�Zallofz0schema definition for field '{0}' must be a dictzvalidation schema missingc@s�eZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Ze	dd
��Z
e	dd��Ze	dd��Ze	dd��Z
e	dd��Ze	dd��ZdS)�ValidationErrorz:A simple class to store and query basic error information.cCs.||_||_||_||_||_||_||_dS�N)�
document_path�schema_path�code�rule�
constraint�value�info)�selfr@rArBrCrDrErF�rH�@/opt/alt/python38/lib/python3.8/site-packages/cerberus/errors.py�__init__^szValidationError.__init__cCst|�t|�kS)z:Assumes the errors relate to the same document and schema.)�hash�rG�otherrHrHrI�__eq__qszValidationError.__eq__cCst|j�t|j�At|j�AS)z>Expects that all other properties are transitively determined.)rKr@rArB�rGrHrHrI�__hash__uszValidationError.__hash__cCs,|j|jkrt|j|j�St|j|j�SdSr?)r@rrArLrHrHrI�__lt__yszValidationError.__lt__c
Cs>dj|jjtt|��|j|jt|j�t|j	�t|j
�|jd�S)Nz�{class_name} @ {memptr} ( document_path={document_path},schema_path={schema_path},code={code},constraint={constraint},value={value},info={info} ))�
class_nameZmemptrr@rArBrDrErF)�format�	__class__�__name__�hex�idr@rArBrrDrErFrOrHrHrI�__repr__s
��zValidationError.__repr__cCs|jr|jdSdS)zX
        A list that contains the individual errors of a bulk validation error.
        rN)�is_group_errorrFrOrHrHrI�child_errors�szValidationError.child_errorscCs@|js
dStt�}|jD]"}|jt|j�}||�|�q|S)z�
        Dictionary with errors of an \*of-rule mapped to the index of the definition it
        occurred in. Returns :obj:`None` if not applicable.
        N)�is_logic_errorr�listrZrA�len�append)rG�result�error�irHrHrI�definitions_errors�s
z"ValidationError.definitions_errorscCs|jr|jdSdSdS)z6Field of the contextual mapping, possibly :obj:`None`.���N)r@rOrHrHrI�field�s
zValidationError.fieldcCst|jtj@�S)z(``True`` for errors of bulk validations.)�boolrB�ERROR_GROUPrOrHrHrIrY�szValidationError.is_group_errorcCst|jtjtj@�S)z[
        ``True`` for validation errors against different schemas with \*of-rules.
        )rerB�LOGICALrfrOrHrHrIr[�szValidationError.is_logic_errorcCst|jtj@�S)z"``True`` for normalization errors.)rerB�
NORMALIZATIONrOrHrHrI�is_normalization_error�sz&ValidationError.is_normalization_errorN)rU�
__module__�__qualname__�__doc__rJrNrPrQrX�propertyrZrbrdrYr[rirHrHrHrIr>[s$




r>c@seZdZdZdd�ZdS)�	ErrorListz�
    A list for :class:`~cerberus.errors.ValidationError` instances that can be queried
    with the ``in`` keyword for a particular :class:`~cerberus.errors.ErrorDefinition`.
    cs*t|t�st�|j�t�fdd�|D��S)Nc3s|]}|j�kVqdSr?)rB)�.0�x�Zwanted_coderHrI�	<genexpr>�sz)ErrorList.__contains__.<locals>.<genexpr>)�
isinstancer
�	TypeErrorrB�any)rGZerror_definitionrHrqrI�__contains__�s
zErrorList.__contains__N)rUrjrkrlrvrHrHrHrIrn�srnc@s�eZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dd�Z
dd�Zdd�Ze
dd��Ze
dd��Zdd�Zdd�ZdS)�
ErrorTreeNode)�descendants�errors�parent_node�path�	tree_rootcCs8||_|jj|_|d|jjd�|_t�|_i|_dS�Nr)rzr|�depthr{rnryrx)rGr{rzrHrHrIrJ�s

zErrorTreeNode.__init__cCs"t|t�r||jkS||jkSdSr?)rsr
ryrx)rG�itemrHrHrIrv�s

zErrorTreeNode.__contains__cCs|j|=dSr?�rx)rG�keyrHrHrI�__delitem__�szErrorTreeNode.__delitem__cCs
t|j�Sr?)�iterryrOrHrHrI�__iter__�szErrorTreeNode.__iter__cCs>t|t�r.|jD]}|j|jkr|SqdS|j�|�SdSr?)rsr
ryrBrx�get)rGrr`rHrHrI�__getitem__�s


zErrorTreeNode.__getitem__cCs
t|j�Sr?)r]ryrOrHrHrI�__len__�szErrorTreeNode.__len__cCs|��Sr?)�__str__rOrHrHrIrX�szErrorTreeNode.__repr__cCs||j|<dSr?r�)rGr�rErHrHrI�__setitem__�szErrorTreeNode.__setitem__cCst|j�dt|j�S)N�,)�strryrxrOrHrHrIr��szErrorTreeNode.__str__cCs
t|j�Sr?)r]r{rOrHrHrIr~�szErrorTreeNode.depthcCs|jjSr?)r|�	tree_typerOrHrHrIr�szErrorTreeNode.tree_typecCs�|�|�}||j}||jkr,t||�||<||}t|�|jdkr||j�|�|j��|jr�|j	D]}|j
�|�qhn
|�|�dSr})�	_path_of_r~rxrwr]ryr^�sortrYrZr|�add)rGr`Z
error_pathr��node�child_errorrHrHrIr�s




zErrorTreeNode.addcCst||jd�S)N�_path)�getattrr��rGr`rHrHrIr�szErrorTreeNode._path_of_N)rUrjrk�	__slots__rJrvr�r�r�r�rXr�r�rmr~r�r�r�rHrHrHrIrw�s 	

rwcs:eZdZdZddd�Z�fdd�Zdd�Zd	d
�Z�ZS)�	ErrorTreezw
    Base class for :class:`~cerberus.errors.DocumentErrorTree` and
    :class:`~cerberus.errors.SchemaErrorTree`.
    rHcCs8d|_||_d|_t�|_i|_|D]}|�|�q$dS)NrH)rzr|r{rnryrxr��rGryr`rHrHrIrJ szErrorTree.__init__cs6|�|�s"|j�|�|j��ntt|��|�dS)zl
        Add an error to the tree.

        :param error: :class:`~cerberus.errors.ValidationError`
        N)r�ryr^r��superr�r�r��rTrHrIr�)s
z
ErrorTree.addcCs"|�|�}|dk	r|jSt�SdS)z�
        Returns all errors for a particular path.

        :param path: :class:`tuple` of :term:`hashable` s.
        :rtype: :class:`~cerberus.errors.ErrorList`
        N)�fetch_node_fromryrn)rGr{r�rHrHrI�fetch_errors_from5s
zErrorTree.fetch_errors_fromcCs&|}|D]}||}|dkrq"q|S)z�
        Returns a node for a path.

        :param path: Tuple of :term:`hashable` s.
        :rtype: :class:`~cerberus.errors.ErrorTreeNode` or :obj:`None`
        NrH)rGr{�contextr�rHrHrIr�BszErrorTree.fetch_node_from)rH)	rUrjrkrlrJr�r�r��
__classcell__rHrHr�rIr�s

	
r�c@seZdZdZdZdS)�DocumentErrorTreezv
    Implements a dict-like class to query errors by indexes following the structure of a
    validated document.
    ZdocumentN�rUrjrkrlr�rHrHrHrIr�Qsr�c@seZdZdZdZdS)�SchemaErrorTreezq
    Implements a dict-like class to query errors by indexes following the structure of
    the used schema.
    rNr�rHrHrHrIr�Zsr�c@sPeZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dd�Z
dd�ZdS)�BaseErrorHandlerziBase class for all error handlers.
    Subclasses are identified as error-handlers with an instance-test.cOsdS)z%Optionally initialize a new instance.NrH�rG�args�kwargsrHrHrIrJgszBaseErrorHandler.__init__cCst�dS)a,
        Returns errors in a handler-specific format.

        :param errors: An object containing the errors.
        :type errors: :term:`iterable` of
                      :class:`~cerberus.errors.ValidationError` instances or a
                      :class:`~cerberus.Validator` instance
        N��NotImplementedError�rGryrHrHrI�__call__ks	zBaseErrorHandler.__call__cCst�dS)z5Be a superhero and implement an iterator over errors.Nr�rOrHrHrIr�vszBaseErrorHandler.__iter__cCst�dS)z�
        Add an error to the errors' container object of a handler.

        :param error: The error to add.
        :type error: :class:`~cerberus.errors.ValidationError`
        Nr�r�rHrHrIr�zszBaseErrorHandler.addcCsdS)z�
        Optionally emits an error in the handler's format to a stream. Or light a LED,
        or even shut down a power plant.

        :param error: The error to emit.
        :type error: :class:`~cerberus.errors.ValidationError`
        NrHr�rHrHrI�emit�szBaseErrorHandler.emitcCsdS)z�
        Gets called when a validation ends.

        :param validator: The calling validator.
        :type validator: :class:`~cerberus.Validator`
        NrH�rGZ	validatorrHrHrI�end�szBaseErrorHandler.endcCs|D]}|�|�qdS)z�
        Adds all errors to the handler's container object.

        :param errors: The errors to add.
        :type errors: :term:`iterable` of
                      :class:`~cerberus.errors.ValidationError` instances
        N)r�r�rHrHrI�extend�szBaseErrorHandler.extendcCsdS)z�
        Gets called when a validation starts.

        :param validator: The calling validator.
        :type validator: :class:`~cerberus.Validator`
        NrHr�rHrHrI�start�szBaseErrorHandler.startN)rUrjrkrlrJr�r�r�r�r�r�r�rHrHrHrIr�cs	
	r�c@seZdZdd�Zdd�ZdS)�ToyErrorHandlercOstd��dS)NzThis is not supposed to happen.)�RuntimeErrorr�rHrHrIr��szToyErrorHandler.__call__cCsdSr?rHrOrHrHrI�clear�szToyErrorHandler.clearN)rUrjrkr�r�rHrHrHrIr��sr�cs$t���fdd��}tdkr |S�S)z�Cerberus error messages expect regular binary strings.
    If unicode is used in a ValidationError message can't be printed.

    This decorator ensures that if legacy Python is used unicode
    strings are encoded before passing to a function.
    csVdd�}t|�}||j�|_||j�|_||j�|_||j�|_||j�|_�||�S)NcSst|t�r|�d�S|S)z1Helper encoding unicode strings into binary utf-8zutf-8)rsZunicode�encode)rErHrHrI�_encode�s

z0encode_unicode.<locals>.wrapped.<locals>._encode)rr@rArDrErF)�objr`r���frHrI�wrapped�szencode_unicode.<locals>.wrappedr)rr	)r�r�rHr�rI�encode_unicode�sr�c%@s�eZdZdZdddddddd	d
ddd
dddddddddddddddddddddd d!d"d#�$ZdDd%d&�Zd'd(�Zd)d*�Zed+d,��Z	e
d-d.��Zd/d0�Zd1d2�Z
d3d4�Zd5d6�Zd7d8�Zd9d:�Zd;d<�ZdEd>d?�ZdFd@dA�ZdGdBdC�Zd$S)H�BasicErrorHandlerz�
    Models cerberus' legacy. Returns a :class:`dict`. When mangled through :class:`str`
    a pretty-formatted representation of that tree is returned.
    z{0}rzrequired fieldz
unknown fieldzfield '{0}' is requiredz%depends on these values: {constraint}z&{0} must not be present with '{field}'rzempty values not allowedznull value not allowedzmust be of {constraint} typezmust be of dict typez'length of list should be {0}, it is {1}zmin length is {constraint}zmax length is {constraint}z)value does not match regex '{constraint}'zmin value is {constraint}zmax value is {constraint}zunallowed value {value}zunallowed values {0}zmissing members {0}z&field '{field}' cannot be coerced: {0}z&field '{field}' cannot be renamed: {0}zfield is read-onlyz.default value for '{field}' cannot be set: {0}z'mapping doesn't validate subschema: {0}z.one or more sequence-items don't validate: {0}z2one or more keys of a mapping  don't validate: {0}z3one or more values in a mapping don't validate: {0}z one or more definitions validatez#none or more than one rule validatezno definitions validatez&one or more definitions don't validate)$rrrrrrrrrrrrrr r!r"r#r%r'r(r)r*r+r.r/r0r2r4r5r6r7�r:r;r<r=NcCs|dkrin||_dSr?��tree)rGr�rHrHrIrJ�szBasicErrorHandler.__init__cCs|��|�|�|jSr?)r�r��pretty_treer�rHrHrIr��s
zBasicErrorHandler.__call__cCs
t|j�Sr?)rr�rOrHrHrIr�szBasicErrorHandler.__str__cCs&t|j�}|D]}|�||�q|Sr?)rr��_purge_empty_dicts)rGZprettyrdrHrHrIr�s
zBasicErrorHandler.pretty_treecCs^t|�}|�|�|jr$|�|�n6|jr6|�|�n$|j|jkrZ|�|j	|�
|j|��dSr?)r�_rewrite_error_pathr[�_insert_logic_errorrY�_insert_group_errorrB�messages�
_insert_errorr@�_format_messagerdr�rHrHrIr�
s
�zBasicErrorHandler.addcCs
i|_dSr?r�rOrHrHrIr�szBasicErrorHandler.clearcCs|��dSr?)r�r�rHrHrIr�!szBasicErrorHandler.startcCs"|j|jj|j|j||jd��S)N)rDrdrE)r�rBrSrFrDrE)rGrdr`rHrHrIr�$s�z!BasicErrorHandler._format_messagecCs�|d}t|�dkrT||jkrD|j|��}|j|||g7<q�|ig|j|<nnt|�dkr�||jkrvig|j|<|j|d}|r�|jt|�d�}n|��}|�|dd�|�|�|j�dS)z�
        Adds an error or sub-tree to :attr:tree.

        :param path: Path to the error.
        :type path: Tuple of strings and integers.
        :param node: An error message or a sub-tree.
        :type node: String or dictionary.
        rrrcr�N)r]r��poprTrr��update)rGr{r�rd�subtree�newrHrHrIr�)s	

zBasicErrorHandler._insert_errorcCsL|jD]@}|jr|�|�q|jr.|�|�q|�|j|�|j|��qdSr?)	rZr[r�rYr�r�r@r�rd)rGr`r�rHrHrIr�Es
�z%BasicErrorHandler._insert_group_errorc	Cst|j}|�|j|�||��|j��D]H}|D]>}|jrD|�|�q.|jrV|�	|�q.|�|j|�||��q.q&dSr?)
rdr�r@r�rb�valuesr[r�rYr�)rGr`rd�definition_errorsr�rHrHrIr�Qs
�z%BasicErrorHandler._insert_logic_errorcCs6|d}|ds|��n|D]}|�||�qdS)Nrc)r�r�)rGZ
error_listr�r�rHrHrIr�as

z$BasicErrorHandler._purge_empty_dictsrcCs*|jr|�||�n|jr&|�||�dS)zY
        Recursively rewrites the error path to correctly represent logic errors
        N)r[�_rewrite_logic_error_pathrY�_rewrite_group_error_path)rGr`�offsetrHrHrIr�isz%BasicErrorHandler._rewrite_error_pathcCsDt|j�|}|jD]*}|j|d�}|j||_|�||�qdSr?)r]r@rZr�)rGr`r��child_startr��
relative_pathrHrHrIr�rs

z+BasicErrorHandler._rewrite_group_error_pathc
Csxt|j�|}|j��D]Z\}}|s&qd|j|f}|j|f}|D],}|j|d�}	||	|_|�||d�qDqdS)Nz%s definition %sr)r]r@rbrrCr�)
rGr`r�r�rar��nodenamer{r�Zrel_pathrHrHrIr�{s
z+BasicErrorHandler._rewrite_logic_error_path)N)r)r)r)rUrjrkrlr�rJr�r�rmr�r�r�r�r�r�r�r�r�r�r�r�r�rHrHrHrIr��sn�'



	
	r�c@seZdZej��Zded<dS)�SchemaErrorHandlerzunknown rulerN)rUrjrkr�r�rrHrHrHrIr��s
r�)KrlZ
__future__r�collectionsrrrr�	functoolsrZpprintrZcerberus.platformr	r
Zcerberus.utilsrrr
ZCUSTOMZDOCUMENT_MISSINGZREQUIRED_FIELDZ
UNKNOWN_FIELDZDEPENDENCIES_FIELDZDEPENDENCIES_FIELD_VALUEZEXCLUDES_FIELDZDOCUMENT_FORMATZEMPTY_NOT_ALLOWEDZNOT_NULLABLEZBAD_TYPEZBAD_TYPE_FOR_SCHEMAZITEMS_LENGTHZ
MIN_LENGTHZ
MAX_LENGTHZREGEX_MISMATCHZ	MIN_VALUEZ	MAX_VALUEZUNALLOWED_VALUEZUNALLOWED_VALUESZFORBIDDEN_VALUEZFORBIDDEN_VALUESZMISSING_MEMBERSrhZCOERCION_FAILEDZRENAMING_FAILEDZREADONLY_FIELDZSETTING_DEFAULT_FAILEDrfZMAPPING_SCHEMAZSEQUENCE_SCHEMAZ	KEYSRULESZ	KEYSCHEMAZVALUESRULESZVALUESCHEMAZ	BAD_ITEMSrgZNONEOFZONEOFZANYOFZALLOFZSCHEMA_ERROR_DEFINITION_TYPEZSCHEMA_ERROR_MISSING�objectr>r\rnrwr�r�r�r�r�r�r�r�rHrHrHrI�<module>s~





































hI7		H?

Filemanager

Name Type Size Permission Actions
__init__.cpython-38.opt-1.pyc File 826 B 0644
__init__.cpython-38.pyc File 826 B 0644
errors.cpython-38.opt-1.pyc File 20.44 KB 0644
errors.cpython-38.pyc File 20.44 KB 0644
platform.cpython-38.opt-1.pyc File 793 B 0644
platform.cpython-38.pyc File 793 B 0644
schema.cpython-38.opt-1.pyc File 17.55 KB 0644
schema.cpython-38.pyc File 17.55 KB 0644
utils.cpython-38.opt-1.pyc File 3.76 KB 0644
utils.cpython-38.pyc File 3.76 KB 0644
validator.cpython-38.opt-1.pyc File 50.99 KB 0644
validator.cpython-38.pyc File 50.99 KB 0644