관리-도구
편집 파일: json_format.cpython-311.pyc
� P�Dgɍ � � � d Z dZddlZddlmZ ddlZddlZddlmZ ddl Z ddl Z ddlmZ ddl mZ ddl mZ dd l mZ d Z eej j ej j ej j ej j g� � Z eej j ej j g� � Z eej j ej j g� � ZdZdZd Z e j d� � Z! e j d� � Z" G d� de#� � Z$ G d� de$� � Z% G d� de$� � Z& d5d�Z' d6d�Z(d� Z) G d� de*� � Z+d� Z,d� Z-d � Z. d7d"�Z/ d7d#�Z0e1e2fZ3 G d$� d%e*� � Z4d8d&�Z5d'� Z6d(� Z7d)� Z8d*d+gd,d-gd,d-gd.d/gd0d1gd,d-gd2d3gd4�Z9dS )9at Contains routines for printing protocol messages in JSON format. Simple usage example: # Create a proto object and serialize it to a json format string. message = my_proto_pb2.MyMessage(foo='bar') json_string = json_format.MessageToJson(message) # Parse a json format string to proto object. message = json_format.Parse(json_string, my_proto_pb2.MyMessage()) zjieluo@google.com (Jie Luo)� N)�OrderedDict)�methodcaller)� type_checkers)� descriptor)�message_factory)�symbol_databasez%Y-%m-%dT%H:%M:%S�Infinityz -Infinity�NaNu. [�-�](?![�-�])|(?<![�-�])[�-�]z\[[a-zA-Z0-9\._]*\]$c � � e Zd ZdZdS )�Errorz'Top-level module error for json_format.N��__name__� __module__�__qualname__�__doc__� � �}/builddir/build/BUILD/imunify360-venv-2.4.0/opt/imunify360/venv/lib64/python3.11/site-packages/google/protobuf/json_format.pyr r O s � � � � � �/�/�/�/r r c � � e Zd ZdZdS )�SerializeToJsonErrorz&Thrown if serialization to JSON fails.Nr r r r r r S s � � � � � �.�.�.�.r r c � � e Zd ZdZdS )� ParseErrorz Thrown in case of parsing error.Nr r r r r r W s � � � � � �(�(�(�(r r F� Tc �Z � t |||||�� � } | � | |||� � S )a Converts protobuf message to JSON format. Args: message: The protocol buffers message instance to serialize. including_default_value_fields: If True, singular primitive fields, repeated fields, and map fields will always be serialized. If False, only serialize non-empty fields. Singular message fields and oneof fields are not affected by this option. preserving_proto_field_name: If True, use the original proto field names as defined in the .proto file. If False, convert the field names to lowerCamelCase. indent: The JSON object will be pretty-printed with this indent level. An indent level of 0 or negative will only insert newlines. If the indent level is None, no newlines will be inserted. sort_keys: If True, then the output will be sorted by field names. use_integers_for_enums: If true, print integers instead of enum names. descriptor_pool: A Descriptor Pool for resolving types. If None use the default. float_precision: If set, use this to specify float field valid digits. ensure_ascii: If True, strings with non-ASCII characters are escaped. If False, Unicode strings are returned unchanged. Returns: A string containing the JSON formatted protocol buffer message. ��float_precision)�_Printer�ToJsonString) �message�including_default_value_fields�preserving_proto_field_name�indent� sort_keys�use_integers_for_enums�descriptor_poolr �ensure_ascii�printers r � MessageToJsonr( [ sD � �F �$�!���%� '� '� '�'� � � �g�v�y�,� G� G�Gr c �T � t |||||�� � }|� | � � S )a� Converts protobuf message to a dictionary. When the dictionary is encoded to JSON, it conforms to proto3 JSON spec. Args: message: The protocol buffers message instance to serialize. including_default_value_fields: If True, singular primitive fields, repeated fields, and map fields will always be serialized. If False, only serialize non-empty fields. Singular message fields and oneof fields are not affected by this option. preserving_proto_field_name: If True, use the original proto field names as defined in the .proto file. If False, convert the field names to lowerCamelCase. use_integers_for_enums: If true, print integers instead of enum names. descriptor_pool: A Descriptor Pool for resolving types. If None use the default. float_precision: If set, use this to specify float field valid digits. Returns: A dict representation of the protocol buffer message. r )r �_MessageToJsonObject)r r r! r$ r% r r'