File: //opt/cppython/lib/python3.8/site-packages/google/protobuf/__pycache__/json_format.cpython-38.pyc
U
ID�g�� � @ s� d Z dZddlZddlmZ ddlZddlZddlmZ ddl Z ddl
mZ ddl
mZ ddl
m
Z
dd lmZ eejjejjejjejjg�Zeejjejjg�Zeejjejjg�Zd
ZdZdZe �d
�Ze �d�Z G dd� de!�Z"G dd� de"�Z#G dd� de"�Z$G dd� de$�Z%dBdd�Z&dCdd�Z'dd� Z(G d d!� d!e)�Z*d"d#� Z+d$d%� Z,d&d'� Z-dDd)d*�Z.dEd+d,�Z/e0e1fZ2G d-d.� d.e)�Z3dFd/d0�Z4d1d2� Z5d3d4� Z6d5d6� Z7d7d8gd9d:gd9d:gd;d<gd=d>gd9d:gd?d@gdA�Z8dS )Gat 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)�
descriptor)�message_factory)�symbol_database)�
type_checkers�Infinityz -Infinity�NaNu. [�-�](?![�-�])|(?<![�-�])[�-�]z\[[a-zA-Z0-9\._]*\]$c @ s e Zd ZdZdS )�Errorz'Top-level module error for json_format.N��__name__�
__module__�__qualname__�__doc__� r r �H/opt/cppython/lib/python3.8/site-packages/google/protobuf/json_format.pyr
= s r
c @ s e Zd ZdZdS )�SerializeToJsonErrorz&Thrown if serialization to JSON fails.Nr r r r r r A s r c @ s e Zd ZdZdS )�
ParseErrorz Thrown in case of parsing error.Nr r r r r r E s r c @ s e Zd ZdZdS )�EnumStringValueParseErrorzvThrown if unknown string enum value is encountered.
This exception is suppressed if ignore_unknown_fields is set.
Nr r r r r r I s r F� Tc
C s t |||||�} | �| |||�S )a& Converts protobuf message to JSON format.
Args:
message: The protocol buffers message instance to serialize.
always_print_fields_with_no_presence: If True, fields without
presence (implicit presence scalars, repeated fields, and map fields) will
always be serialized. Any field that supports presence is not affected by
this option (including singular message fields and oneof fields).
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.
)�_Printer�ToJsonString)
�message�preserving_proto_field_name�indent� sort_keys�use_integers_for_enums�descriptor_pool�float_precision�ensure_ascii�$always_print_fields_with_no_presence�printerr r r �
MessageToJsonO s $�r"