L i)ddlmZmZmZddlmZddlZddlZGddeZGddZ dZ d Z d Z d Z d Zd ZdZeefdZdZdZdZdZy))MappingMutableMappingSequence)urlsplitNc@eZdZdZdZdZdZdZdZdZ dZ d Z y ) URIDictz8 Dictionary which uses normalized URIs as keys. c4t|jSN)rgeturlselfuris W/mnt/ssd/data/python-lab/Trading/venv/lib/python3.12/site-packages/jsonschema/_utils.py normalizezURIDict.normalize s}##%%cZt|_|jj|i|yr )dictstoreupdate)r argskwargss r__init__zURIDict.__init__s$V  4*6*rc>|j|j|Sr rrr s r __getitem__zURIDict.__getitem__szz$..-..rc@||j|j|<yr r)r rvalues r __setitem__zURIDict.__setitem__s*/ 4>>#&'rc<|j|j|=yr rr s r __delitem__zURIDict.__delitem__s JJt~~c* +rc,t|jSr )iterrr s r__iter__zURIDict.__iter__DJJrc,t|jSr )lenrr#s r__len__zURIDict.__len__s4::rc,t|jSr )reprrr#s r__repr__zURIDict.__repr__"r%rN) __name__ __module__ __qualname____doc__rrrrr r$r(r+rrrrs/&+/0,  rrceZdZdZdZy)UnsetzG An as-of-yet unset attribute or unprovided default parameter. cy)Nzr0r#s rr+zUnset.__repr__+srN)r,r-r.r/r+r0rrr2r2&s rr2cF|s|S|ddjd|DdS)aB Construct a single string containing indexing operations for the indices. For example for a container ``bar``, [1, 2, "foo"] -> bar[1][2]["foo"] Arguments: container (str): A word to use for the thing being indexed indices (sequence): The indices to format. [z][c32K|]}t|ywr r*).0indexs r z"format_as_index..Bs#EEDK#E])join) containerindicess rformat_as_indexr@/s0" [$))#EW#EEFa HHrc#K|jdi}dj|jdi}|D]$}||vs|rtj||r!|&yw)z Return the set of additional properties for the given ``instance``. Weeds out properties that should have been validated by ``properties`` and / or ``patternProperties``. Assumes ``instance`` is dict-like already. properties|patternPropertiesN)getr=research)instanceschemarBpatternspropertys rfind_additional_propertiesrLEsaL"-Jxx #6;.\s5UT%[5r;)r'r=)extrasverbs r extras_msgrUWs0K1$5&D 995f5 5t ;;rc,t|tr|gS|S)z] Wrap ``thing`` in a list if it's a single str. Otherwise, return it unchanged. ) isinstancestr)things r ensure_listrZ_s %w Lrcxt|tk7rytfd|jDS)zI Check if two mappings are equal using the semantics of `equal`. Fc3NK|]\}}|vxrt||ywr equal)r8keyrtwos rr:z!_mapping_equal..ps4 C s -uUCH--s"%)r'allitemsoner`s `r_mapping_equalrejs8 3x3s8 ))+ rcjt|t|k7rytdt||DS)zJ Check if two sequences are equal using the semantics of `equal`. Fc3:K|]\}}t||ywr r])r8ijs rr:z"_sequence_equal..|s5tq!uQ{5s)r'raziprcs r_sequence_equalrkvs. 3x3s8 5s3}5 55rc4||uryt|tst|tr||k(St|trt|tr t||St|trt|tr t ||St |t |k(S)z Check if two things are equal evading some Python type hierarchy semantics. Specifically in JSON Schema, evade `bool` inheriting from `int`, recursing into sequences to do the same. T)rWrXrrkrreunboolrcs rr^r^s~ cz#sz#s3cz#x ZX%>sC((#wJsG$<c3'' #;&+ %%rc|dur|S|dur|S|S)zH A hack to make True and 1 and False and 0 unique for ``uniq``. TFr0)elementtruefalses rrmrms"$ E  Nrc@ td|D}tj|dd}t||D]\}}t ||sy y#t t f$r?g}|D]5}t|}|D]}t ||sYy|j|7YywxYw)z Check if all of a container's elements are unique. Tries to rely on the container being recursively sortable, or otherwise falls back on (slow) brute force. c32K|]}t|ywr )rm)r8rhs rr:zuniq..s3AfQi3r;rNNFT) sorted itertoolsislicerjr^NotImplementedError TypeErrorrmappend)r>sortslicedrhriseenes runiqr~s333!!$40f% DAqQ{    +  Aq A !A;  ! KKN   s*AA A A2BBBBc |j|drgSg}d|vrttt|S|j d}|f|j j |}|jt|j|j|j||j|j d}|f|j j |}|jt|j|j|j||jd|vr#|ttt|dz }d|vrf|j|d j|r+|t|||dz }d |vr+|t|||d z }nd |vr|t|||d z }d D]P}||vst|D];\}} |j|| j| s+|j|=Rd D]@}||vs||D]1} t|j!|| d} | "|t||| z }3B|S)z Get all indexes of items that get evaluated under the current schema. Covers all keywords related to unevaluatedItems: items, prefixItems, if, then, else, contains, unevaluatedItems, allOf, oneOf, anyOf booleanrb$refNrI _resolver $dynamicRef prefixItemsifrIthenelse)containsunevaluatedItemsallOfoneOfanyOf)is_typelistranger'rErlookupextend%find_evaluated_item_indexes_by_schemaevolvecontentsresolveris_valid enumeraterynextdescend) validatorrHrIevaluated_indexesrefresolved dynamicRefkeywordkv subschemaerrss rrrs+ &E#h-()) **V C &&--c2  1  #,,&//!!!   M*J&&--j9  1  #,,&//!!!   T%F=,A(B"CDD v~   6$<  0 9 9( C !F8VD\"  !%Jx&!v  !F8VF^"  40 f !(+ 01##6'?#;DDQG%,,Q/ 00 / f #G_  I--h BDI<%)N!8Y*%  rcd j|drgSg}|jd}|fjj|}|j t j |j|j||j|jd}|fjj|}|j t j |j|j||j|jd}j|dr$||j|jzz }dD]3}|j|x | fd|jDz }5d |vr9|D]4} |d D]*} tj| | s|j| ,6d |vr0|d jD]\} | |vr |t | z }d D]E}|j|gD]. tj| s|t | z }0Gd |vrgj |d  j|r,|t ||d z }d|vr|t ||dz }|Sd|vr|t ||dz }|S)a Get all keys of items that get evaluated under the current schema. Covers all keywords related to unevaluatedProperties: properties, additionalProperties, unevaluatedProperties, patternProperties, dependentSchemas, allOf, oneOf, anyOf, if, then, else rrrrrBobject)additionalPropertiesunevaluatedPropertiesc3^K|]$\}}tj|r|&ywr )rr)r8r_rrrs rr:z9find_evaluated_property_keys_by_schema..4s2 U ))%;<  s*-rDdependentSchemasrrrrr)rrErrr&find_evaluated_property_keys_by_schemarrrkeysrbrFrGryrr) rrHrIevaluated_keysrrrrBrrKpatternrs ` @rrrs!+ N **V C &&--c2 2  #,,&//!!!   M*J&&--j9 2  #,,&//!!!   L)JX.*//+hmmo==D G, ,I 5  &nn.   f$  4H!"56 499Wh/"))(3 4 4 V##)*<#=#C#C#E  Hix' D8Y N /GR0 II--h BC D8Y N  v~   6$<  0 9 9( C D8VD\ N"Hx#  v  D8VF^ N rct|dduS)z2Whether there are no errors in the given iterator.N)r)errs_its rrras  $ &&r)collections.abcrrr urllib.parserrurFrr2r@rLrUrZrerkr^rrmr~rrrr0rrrsv==!  n >I,$< 6&$ 8JZYx'r