Xj< pUddlmZddlmZddlmZmZddlmZddlZddl Z ddl Z ddl Z ddl m Z e jegefZe j$deZeeeeed fzZe j0d e j2ZGd d ZeZeZeZeZeZ eZ!e"eeeee e! Z#de$d< dM dNdZ%e%de%ddOdZ&e%ddddddejNdOdZ(e%dejNdOdZ)ee*5ddl+m,Z,e%dddddde-dOdZ.dddee*5ddl/Z/e%d d d e/j`e1f!dOd"Z2ddd ddl3Z3e%d#d#d#e-!dOd$Z4e%d%d%d%e-!dOd&Z5e%d'e-dOd(Z6e%d)d)d)d)e-*dOd+Z7ee*5dd2l=m>Z>e%d3dOd4Z?e%d5d5d56dOd7Z@ddde%d8e jdOd9ZBe%d:d:d:d:e-;dOd<ZCe%d5e-=dOd>ZDee*5ddlEZEe%d?e-eFf=dOd@ZGdddee*5ddlHZHe%dAdAdAdAeHj*dOdBZJe%dCdCdCeHj!dOdDZKdddee*5ddlLZLe%dEdEdEdEFdOdGZMdddee*5ddlNZNe%dHdHeNjIdOdJZPddde%dKdKe-IdOdLZQy#1swYxYw#1swYxYw#e*$ree*5dd,l8m9Z9e%d'dOd-Z6e%d)d)d)d)e-*dOd.Z7dddn #1swYnxYwee*5dd/l:m;Z<e%d#d#d#e-!dOd0Z4e%d%d%d%e-!dOd1Z5dddn #1swYnxYwYwxYw#1swYxYw#1swYxYw#1swYHxYw#1swY-xYw#1swY xYw)P) annotations)suppress)datedatetime)UUIDN) FormatError_F)bound.z^\d{4}-\d{2}-\d{2}$ceZdZUdZiZded<d d dZdZ d ddZe d ddZ e d dd Z dd Z dd Z y) FormatCheckeraz A ``format`` property checker. JSON Schema does not mandate that the ``format`` property actually do any validation. If validation is desired however, instances of this class can be hooked into validators to enable format validation. `FormatChecker` objects always return ``True`` when asked about formats that they do not know how to validate. To add a check for a custom format use the `FormatChecker.checks` decorator. Arguments: formats: The known formats to validate. This argument can be used to limit which formats will be used during validation. z3dict[str, tuple[_FormatCheckCallable, _RaisesType]]checkersNc||jj}|Dcic]}||j|c}|_ycc}wN)r keys)selfformatsks f/mnt/ssd/data/Dropbox/adrian/vault-secondbrain/venv/lib/python3.12/site-packages/jsonschema/_format.py__init__zFormatChecker.__init__1s< ?mm((*G6=>DMM!,,> >sAc4dt|jdS)Nz)sortedr )rs r__repr__zFormatChecker.__repr__6s)&*?)@BBcdfd }|S)a Register a decorated function as validating a new format. Arguments: format: The format that the decorated function will check. raises: The exception(s) raised by the decorated function when an invalid instance is found. The exception object will be accessible as the `jsonschema.exceptions.ValidationError.cause` attribute of the resulting validation error. c*|fj<|Srr )funcformatraisesrs r_checksz%FormatChecker.checks.._checksPs%)6NDMM& !Krrr returnr )rrr r!s``` rcheckszFormatChecker.checks9s. rc`tjdtd|j||S)NzoFormatChecker.cls_checks is deprecated. Call FormatChecker.checks on a specific FormatChecker instance instead.) stacklevel)rr )warningswarnDeprecationWarning _cls_checks)clsrr s r cls_checkszFormatChecker.cls_checksVs2    fV<._checksis$(&>CLL Krr"r$)r-rr r!s``` rr,zFormatChecker._cls_checkses rc||jvry|j|\}}d\}} ||}|st|d||y#|$r }|}Yd}~!d}~wwxYw)a Check whether the instance conforms to the given format. Arguments: instance (*any primitive type*, i.e. str, number, bool): The instance to check format: The format that instance should conform to Raises: FormatError: if the instance does not conform to ``format`` N)NNz is not a )cause)r r)rinstancerrr resultr2es rcheckzFormatChecker.checkosu*  & }}V, f"  (^F JvjAO O E sAA AAcH |j||y#t$rYywxYw)aW Check whether the instance conforms to the given format. Arguments: instance (*any primitive type*, i.e. str, number, bool): The instance to check format: The format that instance should conform to Returns: bool: whether it conformed TF)r6r)rr3rs rconformszFormatChecker.conformss.&  JJx (  s  !!r)rztyping.Iterable[str] | None)r$)rstrr _RaisesTyper#typing.Callable[[_F], _F])r3objectrr9r#None)r3r<rr9r#bool)__name__ __module__ __qualname____doc__r __annotations__rrr% classmethodr.r,r6r8r$rrr r s2   ? C24#. ":02 = ="- = " = =02"- "PBrr )draft3draft4draft6draft7 draft201909 draft202012zdict[str, FormatChecker]_draft_checkersctxs|xs|xs|xs|xs|xs|dfd }|S)Ncrtdj|}rtdj|}rtdj|}rtdj|}rtdj|}rtdj|}tjxsxsxs xsxs||S)NrErFrGrHrIrJ)rKr%r r,)rrIrJrErFrGrHr s rwrapz_checks_drafts..wraps "8,33FFCDID "8,33FFCDID "8,33FFCDID "8,33FFCDID "=188fMD "=188fMD !!  N; N& NF Nf N     rr"r$) namerErFrGrHrIrJr rNs ``````` r_checks_draftsrPsN^tF ^tF ^tF ^tF%K%K4 Krz idn-email)rOemailc,t|tsyd|vS)NT@) isinstancer9r3s ris_emailrVs h $ (?rz ip-addressipv4)rErFrGrHrIrJr c`t|tsyttj|SNT)rTr9r> ipaddress IPv4AddressrUs ris_ipv4r\s' h $  %%h/ 00ripv6)rOr cjt|tsytj|}t |dd S)NTscope_id)rTr9rZ IPv6Addressgetattr)r3addresss ris_ipv6rds1 h $##H-Gw B/ //r)FQDNz host-namehostnamecRt|tsyt|djS)NT) min_labels)rTr9reis_validrUs r is_host_namerk s$(C(H+444rz idn-hostname)rHrIrJr cPt|tsytj|yrY)rTr9idnaencoderUs ris_idn_host_namero"s (C( HriricRt|tsytj|dS)NTIRIrulerTr9rfc3987parserUs ris_irirxbs"(C(}}XE22rz iri-referencecRt|tsytj|dS)NT IRI_referencersrurUs ris_iri_referencer{ms"(C(}}XO<t|tsyt|dSr~rTr9rrUs rrr5sh,#H59 9rc>t|tsyt|dSrrrUs rrr;sh,#H?C Cr)is_valid_syntaxc<t|tsytd|S)NTrprTr9_rfc3987_is_valid_syntaxrUs rrxrxJsh,+E8< recompilerUs ris_regexrs# h $  8$ %%rr)rErHrIrJr ct|tsyttj |xrt j |SrY)rTr9r>_RE_DATE fullmatchr fromisoformatrUs ris_daters7 h $ ""8,M1C1CH1M NNr)rEr cbt|tsyttj|dS)NTz%H:%M:%S)rTr9r>rstrptimerUs ris_draft3_timers' h $ !!(J7 88rcolorct|tr tj|yy#t$r&tj |j YywxYwrY)rTr9 webcolors name_to_hex ValueError normalize_hexlowerrUs ris_css21_colorrsM h $ :%%h/ :''(89 :s),AAz json-pointerc`t|tsyttj|SrY)rTr9r> jsonpointer JsonPointerrUs ris_json_pointerrs'(C(K++H566rzrelative-json-pointerc0t|tsy|sygd}}t|D]L\}}|jr-|dkDrt ||dz dk(ry|j |C|sy||d}n|dk(xst tj|S)NTFr`rrh#) rTr9 enumerateisdigitintappendr>rr)r3non_negative_integerresti characters ris_relative_json_pointerrs(C(%'d%h/ LAy  "q5S!a%1Q6 $++I6'ABzis_uuid.."sIXx!S(Is) )rTr9rallrUs`ris_uuidrs* h $N II IIr)NNNNNNNr$)r#r;)r3r<r#r>)R __future__r contextlibrrrrrrZrtypingr)jsonschema.exceptionsrCallabler<r>_FormatCheckCallableTypeVarr type Exceptionrr:rASCIIrr draft3_format_checkerdraft4_format_checkerdraft6_format_checkerdraft7_format_checkerdraft201909_format_checkerdraft202012_format_checkerdictrKrCrPrVAddressValueErrorr\rd ImportErrorfqdnrerrkrm IDNAError UnicodeErrorrorvrxr{rrrfc3986_validatorrrfc3987_syntaxrrrfc3339_validatorrrrerrorrrrr TypeErrorrrJsonPointerExceptionrrrrrDurationParsingExceptionrrr$rrrs"# -x~6V^^D 459od9os&: ;; 2::,bhh 7SSl&%%%*_*_,0 ** -)      ++\[!W"       & &11 VI$?$?@0A0k5 5 55*k"" -    "Y=d  3  3 ##  =  = z2333 ## == k52%2&2  5  55(WRXX.&/&     OO vj1929 k 7J +BCD k0D""// 77&++//  D  D30Dfk /""  /  / /k 333 3  3 3   J  Jk55*&-G + D6 U # : $ : ""''   D  D!DDD* + GN    =   = "''   G   G)GGG--Gt55^  0D0Df / / 3 3s9L?&$M M*)O7#P APP!P+?M  M O4&+N O4N# O4.-O$ O4$O- )O43O47PPPP(+P5