hf"dZdZddlZddlmZddlmZddlmZejdkrddlm Z ndd l m Z e j Zd Zd Zd ZGd deZddZdS)aoProvides a factory class for generating dynamic messages. The easiest way to use this class is if you have access to the FileDescriptor protos containing the messages you want to create you can just do the following: message_classes = message_factory.GetMessages(iterable_of_file_descriptors) my_proto_instance = message_classes['some.proto.package.MessageName']() z"matthewtoia@google.com (Matt Toia)N)api_implementation)descriptor_pool)messagepython)python_message) cpp_messagecJt|dd}|r|St|S)a7Obtains a proto2 message class based on the passed in descriptor. Passing a descriptor with a fully qualified name matching a previous invocation will cause the same class to be returned. Args: descriptor: The descriptor to build from. Returns: A class describing the passed in descriptor. _concrete_classN)getattr_InternalCreateMessageClass) descriptorconcrete_classs /builddir/build/BUILD/imunify360-venv-2.3.5/opt/imunify360/venv/lib64/python3.11/site-packages/google/protobuf/message_factory.pyGetMessageClassr:s2:'8$??.  $Z 0 00cdi}|D]}||}|jD]}t|||j<|jD]F}t|j}|||jrt|jG|S)akGets all the messages from specified files. This will find and resolve dependencies, failing if the descriptor pool cannot satisfy them. Args: files: The file names to extract messages from. pool: The descriptor pool to find the files including the dependent files. Returns: A dictionary mapping proto names to the message classes. ) FindFileByNamemessage_types_by_namevaluesr full_nameextensions_by_namecontaining_typeRegisterExtension message_type)filespoolresult file_name file_descdesc extensionextended_classs rGetMessageClassesForFilesr#Ls &00i##I..I/668855.t44fT^188::00 &y'@AAn&&y111  0 .///0 -rcB|j}t|tjf|dd}|jD]}|jrt |j|jjD]F}t |j }| ||jrt |jG|S)zBuilds a proto2 message class based on the passed in descriptor. Args: descriptor: The descriptor to build from. Returns: A class describing the passed in descriptor. N) DESCRIPTOR __module__) name _GENERATED_PROTOCOL_MESSAGE_TYPErMessagefieldsrrr% extensionsrr)r descriptor_name result_classfieldr!r"s rr r tsO/1"  , **e *e()))*5..i$Y%>??N$$Y///.i,--- rc,eZdZdZddZdZdZdZdS)MessageFactoryz@Factory for creating Proto2 messages from descriptors in a pool.Nc:|ptj|_dS)zInitializes a new factory.N)rDescriptorPoolr)selfrs r__init__zMessageFactory.__init__s8688DIIIrcHtjdt|S)aEObtains a proto2 message class based on the passed in descriptor. Passing a descriptor with a fully qualified name matching a previous invocation will cause the same class to be returned. Args: descriptor: The descriptor to build from. Returns: A class describing the passed in descriptor. zMessageFactory class is deprecated. Please use GetMessageClass() instead of MessageFactory.GetPrototype. MessageFactory class will be removed after 2024.)warningswarnrr3r s r GetPrototypezMessageFactory.GetPrototypes1 MEFFF : & &&rcHtjdt|S)a,Builds a proto2 message class based on the passed in descriptor. Don't call this function directly, it always creates a new class. Call GetMessageClass() instead. Args: descriptor: The descriptor to build from. Returns: A class describing the passed in descriptor. zDirectly call CreatePrototype is wrong. Please use GetMessageClass() method instead. Directly use CreatePrototype will raise error after July 2023.)r6r7r r8s rCreatePrototypezMessageFactory.CreatePrototypes1 MFGGG 'z 2 22rcTtjdt||jS)aGets all the messages from a specified file. This will find and resolve dependencies, failing if the descriptor pool cannot satisfy them. Args: files: The file names to extract messages from. Returns: A dictionary mapping proto names to the message classes. This will include any dependent messages as well as any messages defined in the same file as a specified message. zMessageFactory class is deprecated. Please use GetMessageClassesForFiles() instead of MessageFactory.GetMessages(). MessageFactory class will be removed after 2024.)r6r7r#r)r3rs r GetMessageszMessageFactory.GetMessagess1 M0111 %UDI 6 66rN)__name__r& __qualname____doc__r4r9r;r=rrr0r0s[HH9999'''"333"77777rr0c|ptjd|Dfdr%d%td|DS)aBuilds a dictionary of all the messages available in a set of files. Args: file_protos: Iterable of FileDescriptorProto to build messages out of. pool: The descriptor pool to add the file protos. Returns: A dictionary mapping proto names to the message classes. This will include any dependent messages as well as any messages defined in the same file as a specified message. ci|] }|j| SrBr'.0 file_protos r zGetMessages..sLLL**/:LLLrc|jD]$}|vr|%|dSr>) dependencypopAdd)rHrK_AddFiledes_pool file_by_names rrNzGetMessages.._AddFilesW +// | # #!!*--... LLrcg|] }|j SrBrErFs r zGetMessages..s555:z555r)rr2popitemr#) file_protosrrNrOrPs @@@rr=r=s 5_355(LL LLL, ( H\ ! ! # #A &''' ( "55555x A AArr>)rA __author__r6google.protobuf.internalrgoogle.protobufrrTyper message_implgoogle.protobuf.pyextrGeneratedProtocolMessageTyper(rr#r objectr0r=rBrrr^s>2 777777++++++######((EEEEEEE??????$0#L 111$%%%P>;7;7;7;7;7V;7;7;7|AAAAAAr