관리-도구
편집 파일: symbol_database.cpython-311.pyc
� P�Dg� � � � d Z ddlZddlmZ ddlmZ ddlmZ G d� d� � Z e ej � � �� � Z d � ZdS ) aS A database of Python protocol buffer generated symbols. SymbolDatabase is the MessageFactory for messages generated at compile time, and makes it easy to create new instances of a registered type, given only the type's protocol buffer symbol name. Example usage:: db = symbol_database.SymbolDatabase() # Register symbols of interest, from one or multiple files. db.RegisterFileDescriptor(my_proto_pb2.DESCRIPTOR) db.RegisterMessage(my_proto_pb2.MyMessage) db.RegisterEnumDescriptor(my_proto_pb2.MyEnum.DESCRIPTOR) # The database can be used as a MessageFactory, to generate types based on # their name: types = db.GetMessages(['my_proto.proto']) my_message_instance = types['MyMessage']() # The database's underlying descriptor pool can be queried, so it's not # necessary to know a type's filename to be able to generate it: filename = db.pool.FindFileContainingSymbol('MyMessage') my_message_instance = db.GetMessages([filename])['MyMessage']() # This functionality is also provided directly via a convenience method: my_message_instance = db.GetSymbol('MyMessage')() � N)�api_implementation)�descriptor_pool)�message_factoryc �Z � e Zd ZdZi Zdd�Zd� Zd� Zd� Zd� Z d� Z d � Zd � Zd� Z d� Zd � ZdS )�SymbolDatabasez'A database of Python generated symbols.Nc �: � |pt j � � | _ dS )z!Initializes a new SymbolDatabase.N)r �DescriptorPool�pool)�selfr s ��/builddir/build/BUILD/imunify360-venv-2.4.0/opt/imunify360/venv/lib64/python3.11/site-packages/google/protobuf/symbol_database.py�__init__zSymbolDatabase.__init__I s � ��8��6�8�8�D�I�I�I� c �R � t j d� � t j |� � S )Nz�SymbolDatabase.GetPrototype() is deprecated. Please use message_factory.GetMessageClass() instead. SymbolDatabase.GetPrototype() will be removed soon.)�warnings�warnr �GetMessageClass�r � descriptors r �GetPrototypezSymbolDatabase.GetPrototypeM s2 � ��M� H� I� I� I� �*�:�6�6�6r c �R � t j d� � t j |� � S )Nz�Directly call CreatePrototype() is wrong. Please use message_factory.GetMessageClass() instead. SymbolDatabase.CreatePrototype() will be removed soon.)r r r �_InternalCreateMessageClassr s r �CreatePrototypezSymbolDatabase.CreatePrototypeS s2 � ��M� K� L� L� L� �6�z�B�B�Br c �^ � t j d� � t j || j � � S )Nz�SymbolDatabase.GetMessages() is deprecated. Please use message_factory.GetMessageClassedForFiles() instead. SymbolDatabase.GetMessages() will be removed soon.)r r r �GetMessageClassedForFilesr )r �filess r �GetMessageszSymbolDatabase.GetMessagesY s6 � ��M� G� H� H� H� �4�U�D�I�F�F�Fr c �R � |j }|| j |<