3|5 d dl mZ d dlmZ d dlmZ d dlmZmZm Z m Z mZmZ d dl mZmZmZmZ G d de Z G d d e Z G d de Z G d d e Z G d de Z G d de Z G d de Z G d de Z G d de Z e e cZZdS ) )absolute_import)warn)errors) _str_typeCallableHashableMappingMutableMappingSequence)get_Validator_classvalidator_factorymapping_hashTypeDefinitionc e Zd ZdS )_AbortN)__name__ __module____qualname__ o/builddir/build/BUILD/imunify360-venv-2.6.2/opt/imunify360/venv/lib/python3.11/site-packages/cerberus/schema.pyr r s Dr r c e Zd ZdZdS )SchemaErrorz_ Raised when the validation schema is missing, has the wrong format or contains errors.N)r r r __doc__r r r r r s Dr r c e Zd ZdZ fdZd Zd Zd Zd Zd Z d Z d Zd Zd Z ed Zed Zed ZddZd Zd Zed Zd ZddZd Z xZS )DefinitionSchemaz1A dict-subclass for caching of validated schemas.c v dt vrt dt at j }| t dt fd t dt fd d |t _ t t | | S )NSchemaValidatorcallabler hashable)r r ) globalsr SchemaValidatorMixinr types_mappingcopyupdater r r superr __new__)clsargskwargsr# __class__s r r' zDefinitionSchema.__new__% s GII--/0ACWXXO+9>>@@M .zH; K K .zH; K K -:O)%s++33C888r c d t |t st d || _ t |t r|j || }t |t sK t | }n:# t $ r- t t j | w xY wt | | _ t! d| j t j || | _ | | }| | || _ dS )z :param validator: An instance of Validator-(sub-)class that uses this schema. :param schema: A definition-schema as ``dict``. Defaults to an empty one. z0validator argument must be a Validator-instance.N) allow_unknown error_handler target_schematarget_validator) isinstancer RuntimeError validatorr schema_registrygetr dict Exceptionr r SCHEMA_ERROR_DEFINITION_TYPEformatSchemaValidationSchemavalidation_schemar SchemaErrorHandlerschema_validatorexpandvalidateschema)selfr3 r@ s r __init__zDefinitionSchema.__init__4 s1 )%8%:%:;; VTUUU"fi(( C.2266BBF&'** V Vf V V V!&"E"L"LV"T"TUUU V "8 !B!B /0 3 &! ! ! V$$ fs 9B 7C c | j } ||= | j |= d S # t $ r t d|z t $ r}|d }~ww xY w)Nz Schema has no field '%s' defined)r@ r$ ValueErrorr r7 )rA key_new_schemaes r __delitem__zDefinitionSchema.__delitem__U s k&&(( !C C H H H@3FGGG G s ( %A AAc | j | S N)r@ )rA items r __getitem__zDefinitionSchema.__getitem__` s {4 r c * t | j S rJ )iterr@ rA s r __iter__zDefinitionSchema.__iter__c s DK r c * t | j S rJ )lenr@ rO s r __len__zDefinitionSchema.__len__f s 4;r c t | S rJ )strrO s r __repr__zDefinitionSchema.__repr__i s 4yyr c | d|i d }| ||i || j |<