gh,ddlZddlZddlZddlZddlZddlmZddlmZm Z ddl m Z m Z m Z mZmZmZmZmZddlmZejeZddd d d Zd Zhd ZejdZejdejZdddddZGddeZ edZ!GddZ"GddZ#de$dee$fdZ%dS)N)contextmanager)indentwrap)AnyDictIteratorListOptionalSequenceUnioncast)JsonSchemaValueExceptionzkeys must be named byzat least one item that matchesz"only items matching the definition)z(must be named by propertyName definitionzone of contains definitionz same as const definition:zonly specified items)zmust not be emptyzis always invalidzmust not be there>notanyOfitemsoneOfcontains propertyNamesz\W+|([A-Z][^A-Z\W]*)z^[\w_]+$tablekeykeys)objectproperty propertiesproperty namesc:eZdZdZdZdZdZedefdZ dS)ValidationErroraReport violations of a given JSON schema. This class extends :exc:`~fastjsonschema.JsonSchemaValueException` by adding the following properties: - ``summary``: an improved version of the ``JsonSchemaValueException`` error message with only the necessary information) - ``details``: more contextual information about the error like the failing schema itself and the value that violates the schema. Depending on the level of the verbosity of the ``logging`` configuration the exception message will be only ``summary`` (default) or a combination of ``summary`` and ``details`` (when the logging level is set to :obj:`logging.DEBUG`). rexcXt|}|t||j|j|j|j}t jdd}|dkr|j |j c|_ |_ |j |_ |j |_ |j|_|S)N JSONSCHEMA_DEBUG_CODE_GENERATIONfalse)_ErrorFormattingstrvaluename definitionruleosgetenvlower __cause__ __traceback__message_original_messagesummarydetails)clsr formatterobj debug_codes /builddir/build/BUILD/imunify360-venv-2.6.0/opt/imunify360/venv/lib/python3.11/site-packages/setuptools/config/_validate_pyproject/error_reporting.py_from_jsonschemaz ValidationError._from_jsonschema=s$R(( c#i.."(INBM27SSYA7KKQQSS  /1|R=M ,CM3, " ' '  N) __name__ __module__ __qualname____doc__r1r2r0 classmethodrr8r9r7rr(sV GG ":   [   r9rc#nK dVdS#t$r }t|dd}~wwxYwN)rrr8)r s r7detailed_errorsrBJsM=  #===..r22<=s 4/4cveZdZdefdZdefdZedefdZedefdZ dZ dZ defd Z d S) r$r c||_d||jd|_|jj|j|j|_d|_d|_dS)N`r)r _simplify_namer'r/replacer0_summary_details)selfr s r7__init__z_ErrorFormatting.__init__Ss]7++BG44777 !%!8!8$)!L!L  r9returncttjkr|jr|jd|jS|jS)N )_loggergetEffectiveLevelloggingDEBUGr2r1rJs r7__str__z_ErrorFormatting.__str__ZsB  $ $ & &'- 7 7DL 7l66 66 6|r9cP|js||_|jSrA)rH_expand_summaryrSs r7r1z_ErrorFormatting.summary`'} 3 0022DM}r9cP|js||_|jSrA)rI_expand_detailsrSs r7r2z_ErrorFormatting.detailsgrWr9cbtd}|dr ||dn|S)Nzdata.)len startswith)rJr'xs r7rFz_ErrorFormatting._simplify_namens0 LL??733=tABBxx=r9cj|jtD]\}}||t fdt DrS|jj}|jjtvr4|r2tt}dt||dSS)Nc3 K|]}|vV dSrAr?).0 substringmsgs r7 z3_ErrorFormatting._expand_summary..xs(??IyC??????r9z:  ) r0_MESSAGE_REPLACEMENTSrrGany _SKIP_DETAILSr rule_definitionr) _NEED_DETAILS_SummaryWriter _TOML_JARGONr)rJbadreplschemar1rbs @r7rVz _ErrorFormatting._expand_summaryrs$.4466 ) )IC++c4((CC ??????? ? ? J( 7<= ( (V ($\22GAAwwv ? ?AA A r9c Jg}|jjdg}|jjddpd|}|r?dt |dddd}|d |t j|jjd }t j|jjd }d t|dd |jj dt|dg}d||zS)Nz $$description description  PrdF)widthinitial_indentsubsequent_indentbreak_long_wordsz DESCRIPTION: )rz GIVEN VALUE: zOFFENDING RULE: z DEFINITION: rN) r r(popjoinrappendjsondumpsr&rr))rJoptional desc_linesdescrprnr&defaultss r7rYz _ErrorFormatting._expand_detailss/W'++OR@@ w!%%mT::Rchhz>R>R  <))#)&,%* K OO:[:: ; ; ;DG.q999 47=333 4VE622 4 4 /tw| / / 4F6622 4 4  {{8h.///r9N) r:r;r<rrKr%rTrr1r2rFrVrYr?r9r7r$r$Rs3 X X >>> 0000000r9r$c eZdZhdZddeeeeffdZdeee efdeee effdZ dd d d ee e e fd ed e edefdZ de edefdZd e de efdZde de edeefdZ dded ede edefdZde efdZde edefdZdede edefdZd e de edeefdZdededefdZdS) rj>titledefaultexamplesrpNjargonc |pi|_dddd|ddddd|d |d d d d d |_gd|_dS)Nzat least one of the followingzexactly one of the followingzall of the followingz(*NOT* the following)rz (in order)zcontains at least one ofznon-predefined acceptable rrz named via patternzpredefined valuezone of) rrallOfr prefixItemsrrrpatternPropertiesconstenum) rr maxLength minLengthpatternformatminimummaximumexclusiveMinimumexclusiveMaximum multipleOf)r_jargon_terms_guess_inline_defs)rJrs r7rKz_SummaryWriter.__init__s&,l 53+*"ll733@@@2MT\\:J-K-KMM$(LL$>$>!R!R!R'   " # # # r9termrLct|trfd|DSj||S)NcFg|]}j||Sr?)rget)r`trJs r7 z*_SummaryWriter._jargon..s)888aDKOOAq))888r9) isinstancelistrr)rJrs` r7rz_SummaryWriter._jargonsE dD ! ! 988884888 8{tT***r9rr?_pathrnprefixrc t|tr||||S|||}|||}|r||S||d}||d}t |dz}tj5} t| D][\} \} } g|| } | dkr|n|}| || | dt| trX|| | }||| }| |rd|nd|| || t| trf| dks|| rK|| || }|d rdnd}| ||.| d|| | d]| cdddS#1swxYwYdS) Nz - rqr:rrrtype[)rr _handle_list_filter_unecessary_handle_simple_dict _child_prefixr[ioStringIO enumeraterwrite_labeldict _is_propertyr\_valuegetvalue)rJrnrrfilteredsimple child_prefix item_prefixrbufferirr& child_path line_prefixchildrenseps r7__call__z_SummaryWriter.__call__s fd # # <$$VVU;; ;**6599))(E::  '&f&& &))&$77 ((66 Vs" []] %f#,X^^-=-=#>#> I I.s/333>>!$$333333r9z$_)rrf_IGNORE)rJrrs @r7_is_unecessaryz_SummaryWriter._is_unecessarys]   T " " $ 52h3333d33333Jsdl7JJr9cHfd|DS)NcNi|]!\}}g|||"Sr?)r)r`rr&rrJs r7 z5_SummaryWriter._filter_unecessary..sK   U&&||s|44    r9)r)rJrnrs` `r7rz!_SummaryWriter._filter_unecessarys<     $llnn    r9r&ctfd|jD}tdD }|s|r-dd||dSdS)Nc3 K|]}|vV dSrAr?)r`pr&s r7rcz5_SummaryWriter._handle_simple_dict..s'AAAQ%ZAAAAAAr9c3NK|] }t|ttfV!dSrA)rrr)r`vs r7rcz5_SummaryWriter._handle_simple_dict..s0MMAd|44MMMMMMr9{, z} )rfrvaluesrz _inline_attrs)rJr&rinliners ` r7rz"_SummaryWriter._handle_simple_dictsAAAA)@AAAAAMMellnnMMMMMM  IV IH $"4"4UD"A"ABBHHH Htr9schemascBrdSt|}td|Drt|dkr|dS|ddfdt |DS)Nrc3PK|]!}t|ttf V"dSrA)rrr)r`es r7rcz._SummaryWriter._handle_list.. s3@@1:a$...@@@@@@r9<rrrc 3JK|]\}}|gd|dVdS)r]rNr?)r`rrrrrJs r7rcz._SummaryWriter._handle_list..s\  >BaDDK'8'8x1xxx'8 9 9 9      r9)rreprallr[rrzr)rJrrrrepr_rs` ` @r7rz_SummaryWriter._handle_lists   t $ $ 2W  @@@@@ @ @ SZZRT__<<< ((66 ww      FOPWFXFX      r9cJd}|dddD] }|dvrn|dz }|dzdkS)zGCheck if the given path can correspond to an arbitrarily named propertyrNr>rrrr?)rJrcounterrs r7rz_SummaryWriter._is_propertysMB<  C=== qLGG{ar9c|^}}||sQt|}|j|p'd||S|ddkrd|dSt |S)Nrqrrz(regex ))r_separate_termsrrrzrr)rJrparentsrnorm_keys r7rz_SummaryWriter._labels #  && L&s++H;??3''K388DLL4J4J+K+K K 2;- - -%S%%% %Cyyr9c|ddkrm||sX||}t|trdd|dnt t |St|S)Nrrrrr)rrrrrzr r%r)rJr&rtype_s r7rz_SummaryWriter._value(s 8v  d&7&7&=&= LL''E+5eT+B+BX'DIIe$$''''SRWHXHX E{{r9c#K|D];\}}g||}||d|||V>> _separate_terms("FooBar-foo") ['foo', 'bar', 'foo'] c:g|]}||Sr?)r,)r`ws r7rz#_separate_terms..>s% E E E!1 EAGGII E E Er9)_CAMEL_CASE_SPLITTERsplit)rs r7rr9s( F E399$?? E E EEr9)&rr|rQr*re contextlibrtextwraprrtypingrrrr r r r r fastjsonschema_exceptionsr getLoggerr:rOrergricompilerI _IDENTIFIERrkrrBr$rjr%rr?r9r7rs  %%%%%%!!!!!!!!MMMMMMMMMMMMMMMMMMMM?????? ' H % %1H"B"$@  YXX !rz"9::bjbd++   .D===F0F0F0F0F0F0F0F0R[7[7[7[7[7[7[7[7|F#F$s)FFFFFFr9