K i<dZddlmZddlmZdZGddeZy)z7Contains _ExtensionDict class to represent extensions. ) type_checkers)FieldDescriptorc t|tstd|z|jstd|jz|j std|jz|j |j urGtd|jd|j jd|j jdy) z0Verify that the given extension handle is valid.z3HasExtension() expects an extension handle, got: %sz"%s" is not an extension.z""%s" is missing a containing_type.z Extension "z" extends message type "z ", but this message is of type "z".N) isinstancerKeyError is_extension full_namecontaining_type DESCRIPTOR)messageextension_handles m/mnt/ssd/data/python-lab/Trading/venv/lib/python3.12/site-packages/google/protobuf/internal/extension_dict.py_VerifyExtensionHandlers $o 6 H#$ %%  & & .1A1K1KK LL  ) ) 7%//0 11%%W-?-?? $..$44>>&&00 2 33@cXeZdZdZdZdZdZdZdZdZ dZ d Z d Z d Z d Zd Zy)_ExtensionDictzDict-like container for Extension fields on proto instances. Note that in all cases we expect extension handles to be FieldDescriptors. c||_y)z^ Args: extended_message: Message instance for which we are the Extensions dict. N)_extended_message)selfextended_messages r__init__z_ExtensionDict.__init__0s .Drct|j||jjj|}||S|jr|j |j}n|j tjk(r|j}t|dsddl m }|j|t|jds!ddl m }|j|j|jj} |j|jj n |j$S|jjj'||}|S#t"$rY3wxYw)z8Returns the current value of the given extension handle._concrete_classr)message_factory)rr_fieldsget is_repeated_default_constructorcpp_typerCPPTYPE_MESSAGE message_typehasattrgoogle.protobufrGetMessageClassr _SetListener_listener_for_childrenReferenceError default_value setdefault)rr resultr!rs r __getitem__z_ExtensionDict.__getitem__7s@4113CD  # # + + / /0@ AF  m##44T5K5KLf  " "o&E&E E%22l \#4 53'' 5 %224E F3''(8(E(EF,,<<>f D22IIJ  + ++ # # + + 6 6&"F M!   s%E E,+E,c&t||jsy|jj}|jj}|Dcgc]}|js|}}|Dcgc]}|js|}}||k(Scc}wcc}w)NF)r __class__r ListFieldsr)rother my_fields other_fieldsfields r__eq__z_ExtensionDict.__eq__`s eT^^ , &&113I**557L%.D51C1CDID'3Jeu7I7IEJLJ  $$EJsB "B ,B>Bc||k( SN)rr/s r__ne__z_ExtensionDict.__ne__msu} rc|jj}|Dcgc]}|djs|}}t|Scc}w)Nr)rr.rlen)rfieldsr2extension_fieldss r__len__z_ExtensionDict.__len__psH  # # . . 0F+1K%U1X5J5JKK   Ls AActd)Nzunhashable object) TypeErrorrs r__hash__z_ExtensionDict.__hash__vs ' ((rc`t|j||js|jtj k(rt d|jztj|}|j||jj|<|jjy)zlIf extension_handle specifies a non-repeated, scalar extension field, sets the value of that field. zKCannot assign to extension "%s" because it is a repeated or composite type.N) rrrrrr r>r rGetTypeChecker CheckValuer _Modified)rr value type_checkers r __setitem__z_ExtensionDict.__setitem__}s 4113CD$$!!_%D%DD  .88 9 :: !//0@AL & ""#34$$&rc:|jj|yr5)rClearExtension)rr s r __delitem__z_ExtensionDict.__delitem__s))*:;rc|jj}|jjj|}|j |dS)zTries to find a known extension with the specified name. Args: name: Extension full name. Returns: Extension field descriptor. N)rr filepool_extensions_by_namer)rname descriptor extensionss r_FindExtensionByNamez#_ExtensionDict._FindExtensionByNames@''22J%%99*EJ >>$ %%rc|jj}|jjj|}|j |dS)zTries to find a known extension with the field number. Args: number: Extension field number. Returns: Extension field descriptor. N)rr rLrM_extensions_by_numberr)rnumberrPrQs r_FindExtensionByNumberz%_ExtensionDict._FindExtensionByNumbers@''22J%%;;JGJ >>&$ ''rcDd|jjDS)Nc3DK|]}|djr|dyw)rN)r).0fs r z*_ExtensionDict.__iter__..s( "Qt   aD "s )rr.r?s r__iter__z_ExtensionDict.__iter__s" "$00;;= ""rc~t|j|||jjvry|jr.t |jjj |S|j tjk(r7|jjj |}|duxr |jSy)NFT) rrrrboolrrrr _is_present_in_parent)rr rEs r __contains__z_ExtensionDict.__contains__s4113CDt55=== ## $((00445EF GG  O$C$CC$$,,001ABe $  >5#>#>> rN)__name__ __module__ __qualname____doc__rr+r3r7r<r@rGrJrRrVr\r`r6rrrr(sD .'R %! )'*< & (" rrN)rdgoogle.protobuf.internalrgoogle.protobuf.descriptorrrobjectrr6rrrhs%3632ZVZr