$L iH UdZddlmZddlmZmZmZddlmZddl m Z m Z m Z m Z mZddlmZddlmZmZmZmZddlmZm ZmZeeefZeezZe eZ e eZ!e Z"d e#d <eGd d e$Z%d>d Z&d>dZ'd?dZ( d@dZ) dAdZ* dAdZ+ dBdZ,e-e-e-f dCdZ.e-e-e-f dCdZ/e-e-e-f dCdZ0e-e-e-f dCdZ1e-e-e-f dCdZ2e-e-e-f dCdZ3e-e-e-f dCdZ4e de&e.hdhdhde)e2hdhdhd Z5e d!e&e/hd"hd#hde*e3hd"hd#hd Z6e d$e'e0hd%hd#hd&e+e4hd%hd#hd& Z7e d'e'e0hd(hd#hd&e+e4hd(hd#hd& Z8e d)e(e1d*hhd#hd&e,e4hd+hd#hd& Z9e d,e(e1d-hhd&.e,e4d/d0hd-hhd& Z:e d1e5fd2e6fd3e7fd4e8fd5e9fd6e:ffDcic]\}}|e jv|c}}ZdEd<Z?y=cc}}w)FzI Referencing implementations for JSON Schema specs (historic & current). ) annotations)IterableSequenceSet)Any)AnchorRegistryResource Specification exceptions)frozen)_UNSETResolvedResolver_Unset)URIrMappingSchemaRegistryEMPTY_REGISTRYceZdZUdZded<y)UnknownDialectz A dialect identifier was found for a dialect unknown by this library. If it's a custom ("unofficial") dialect, be sure you've registered it. ruriN)__name__ __module__ __qualname____doc____annotations__\/mnt/ssd/data/python-lab/Trading/venv/lib/python3.12/site-packages/referencing/jsonschema.pyrr$s HrrcFt|try|jdS)N$id) isinstanceboolget)contentss r _dollar_idr'/s(D! << rc|t|tsd|vry|jd}||jds|Syy)N$refr"#)r#r$r% startswithr&ids r _legacy_dollar_idr.5s@(D!Vx%7 e B ~bmmC0 1~rc\d|vry|jd}||jds|Syy)Nr)r-r*)r%r+r,s r _legacy_idr0=s7  d B ~bmmC0 1~rc#Kt|try|jd}|t||j ||jd}|t ||j |yyw)N$anchornameresourcez$dynamicAnchor)r#r$r%rcreate_resource DynamicAnchor) specificationr&anchordynamic_anchors r _anchorr;Es(D! \\) $F "228<  \\"23N!"228<  "sA6A8ct|trgS|jd}|gSt||j |gS)Nr2r3)r#r$r%rr6)r8r&r9s r _anchor_2019r=ZsN(D! \\) $F ~ "228<  rct|trgS|jdd}|jdsgSt |dd|j |gS)Nr"r*r3)r#r$r%r+rr6r8r&r-s r _legacy_anchor_in_dollar_idrBks](D! eR B ==  AB"228<  rc|jdd}|jdsgSt|dd|j|gS)Nr-r?r*r@r3)r%r+rr6rAs r _legacy_anchor_in_idrD|sN dB B ==  AB"228<  rcdfd }|S)z Create a callable returning JSON Schema specification-style subschemas. Relies on specifying the set of keywords containing subschemas in their values, in a subobject's values, or in a subarray. c3Kt|tryD]}||vs||D]}||vs||Ed{D]"}||vs||jEd{$y7.7 wN)r#r$values)r&each in_subarray in_subvaluesin_values r subresources_ofz)_subresources_of..subresources_ofs h %  %Dxtn$ %  *Dx#D>)) *! 3Dx#D>00222 3*3s1A-A-A-A)A- A-!A+"A-+A-r&SchemareturnIterable[ObjectSchema]rrLrKrJrMs``` r _subresources_ofrSs 3 rcdfd }|S)O Specifically handle older drafts where there are some funky keywords. c3HKt|tryD]}||vs||D]}||vs||Ed{D]"}||vs||jEd{$|jd}| t|tr |Ed{y|yy7a7<7wNitems)r#r$rHr%r)r&rIrXrJrKrLs r rMz:_subresources_of_with_crazy_items..subresources_ofs h %  %Dxtn$ %  *Dx#D>)) *! 3Dx#D>00222 3 W%  %*     *3 !sCB"B"B"BB" B"!B".B"B  B"B" B"rNrrRs``` r !_subresources_of_with_crazy_itemsrYs( rcdfd }|S)rUc3Kt|tryD]}||vs||D]}||vs||Ed{D]"}||vs||jEd{$|jd}|t|tr |Ed{n||jd}|Et |j}t |d}t|tr||Ed{yyy777f7 w)NrX dependencies)r#r$rHr%riternextr r&rIrXr\rHvaluerJrKrLs r rMzG_subresources_of_with_crazy_items_dependencies..subresources_ofs$ h %  %Dxtn$ %  *Dx#D>)) *! 3Dx#D>00222 3 W%  %*    ||N3  #,--/0F&E%) !!!* $*3 !"sVC;C;C;C3C; C;!C5".C;C7AC;+C9,C;5C;7C;9C;rNrrRs``` r ._subresources_of_with_crazy_items_dependenciesras"6 rcdfd }|S)zT Specifically handle even older drafts where there are some funky keywords. c3.KD]}||vs||D]}||vs||Ed{D]"}||vs||jEd{$|jd}|t|tr |Ed{n||jd}|Ct |j}t |d}t|t r||Ed{dD](}|j|}t|t s%|*y77778w)NrXr\)additionalItemsadditionalProperties)rHr%r#rr]r^rr_s r rMzJ_subresources_of_with_crazy_aP_items_dependencies..subresources_ofs9 %Dxtn$ %  *Dx#D>)) *! 3Dx#D>00222 3 W%  %*    ||N3  #,--/0F&E%) !!!= DLL&E%)  '*3 !"s[ DDDD DDD.D?DADD*DDDDD)r& ObjectSchemarPrQrrRs``` r 1_subresources_of_with_crazy_aP_items_dependenciesrgs< rc2||z dfd }|S)Nc|t|}|D]}|vs|vs t|d|cS|j|SrG)r]r^in_subresourcesegmentsresolver subresource _segmentssegmentin_childrLs r maybe_in_subresourcez3_maybe_in_subresource..maybe_in_subresourcesQ N   Gh&x'4 4+@+H  &&{33rrlzSequence[int | str]rm_Resolver[Any]rnz Resource[Any]rPrtrrLrKrJrrrqs` @r _maybe_in_subresourcervs@ k)H 4% 4  4# 4  4 rc2||z dfd }|S)Nct|}|D]M}|dk(r-t|jtr|j |cS|vs:|vs t |dK|cS|j |SrWr]r#r&rrjr^rks r rrz?_maybe_in_subresource_crazy_items..maybe_in_subresource6s N  G'!j$$' ..{;;h&x'4 4+@+H &&{33rrsrrus` @r !_maybe_in_subresource_crazy_itemsrz/@ k)H4%4 4#4  4$ rc2||z dfd }|S)Nct|}|D]L}|dvr-t|jtr|j |cS|vs9|vs t |dJ|cS|j |S)N>rXr\ryrks r rrzL_maybe_in_subresource_crazy_items_dependencies..maybe_in_subresourceRs N  G33 $$9 ..{;;h&x'4 4+@+H &&{33rrsrrus` @r ._maybe_in_subresource_crazy_items_dependenciesr~Kr{rz draft2020-12> ifnotelsethenrXcontains contentSchema propertyNamesunevaluatedItemsreunevaluatedProperties>allOfanyOfoneOf prefixItems>$defs properties definitionsdependentSchemaspatternProperties)rLrJrK)r4id_ofrM anchors_inrrz draft2019-09> rrrrrrrrdrrer>rrrzdraft-07>rrrrrrrdre>rrrzdraft-06>rrrrdrezdraft-04r>rrdrezdraft-03extends)rJrKrdrez,https://json-schema.org/draft/2020-12/schemaz,https://json-schema.org/draft/2019-09/schemaz&http://json-schema.org/draft-07/schemaz&http://json-schema.org/draft-06/schemaz&http://json-schema.org/draft-04/schemaz&http://json-schema.org/draft-03/schemazRegistry[Specification[Schema]]_SPECIFICATIONSctj|jd}| |jS|tur t ||S)z Retrieve the `Specification` with the given dialect identifier. Raises: `UnknownDialect` if the given ``dialect_id`` isn't known r*)rr%rstripr&rr) dialect_iddefaultr5s r specification_withr=sI"":#4#4S#9:H   &Z(( Nrc.eZdZUdZded<ded<ddZy) r7z4 Dynamic anchors, introduced in draft 2020. strr4SchemaResourcer5cP|j}|jD]I\}} |j||jj}t|ts>|j}Kt|j|j|S#t j $rYwxYw)z2 Resolve this anchor dynamically. )r&rm) r5 dynamic_scoper9r4r`r NoSuchAnchorr#r7 _Resolvedr&rj)selfrmlastrregistryr9s r resolvezDynamicAnchor.resolve\s}}%335 'MC !dii8>>&-0  ']],,T2  **  s&BB%$B%Nrmz_Resolver[Schema]rPz_Resolved[Schema])rrrrrrrrr r7r7Ss I rr7cX|jd}t|jtr~|jj drc|j D]P\}}|j|}t|jtr|jj ds|S|}R|S)u Recursive references (via recursive anchors), present only in draft 2019. As per the 2019 specification (§ 8.2.4.2.1), only the ``#`` recursive reference is supported (and is therefore assumed to be the relevant reference). r*z$recursiveAnchor)lookupr#r&rr%r)rmresolvedr_ next_resolveds r lookup_recursive_refrnss#H(##W-(2C2C2G2G3,,. %FC$OOC0M&&#++//0BC O%H % OrN)r&rOrP URI | None)r&rfrPr)r8Specification[Schema]r&rOrPzIterable[AnchorType[Schema]])r8rr&rOrPzIterable[Anchor[Schema]])r8zSpecification[ObjectSchema]r&rfrPzIterable[Anchor[ObjectSchema]])rLSet[str]rKrrJr)rrrzSpecification[Any] | _UnsetrPzSpecification[Any]r)@r __future__rcollections.abcrrrtypingr referencingrr r r r referencing._attrsr referencing._corerrrr _Resolverrreferencing.typingr AnchorTyperrrfr$rOrrrr Exceptionrr'r.r0r;r=rBrD frozensetrSrYrargrvrzr~ DRAFT202012 DRAFT201909DRAFT7DRAFT6DRAFT4DRAFT3opaquerrr7r)rr8s00r rs#33MM% BAsCx   &!&!"*+ Y    (  " *("(" .  $  #&[%K:#&[%KB#&[%K$$$$P#&[%K''''V#&[%K    0#&[%K    :#&[%K    :  $  ? ..  ? 72 h  5  0 .:  0 72 h   B  0G +G  0G % D   B 0G +G 0G  8   E/G $GC/G    EKG$G#%;<KG  4<<[ I ;[ I 5v > 5v > 5v > 5v > *   %J  OHOOM22  40 ",2 (,   4 sK