File: D:/Python311/Lib/site-packages/google/protobuf/__pycache__/json_format.cpython-311.pyc
�
�ncP� � �� � d Z dZddlZddlmZ ddlZddlZddlmZ ddl Z ddl
Z
ddlmZ ddl
mZ ddl
mZ d Z eej j ej j ej j ej j g� � Z eej j ej j g� � Z eej j ej j g� � Zd
ZdZdZ e j d
� � Z e j d� � Z! G d� de"� � Z# G d� de#� � Z$ G d� de#� � Z% d4d�Z& d5d�Z'd� Z( G d� de)� � Z*d� Z+d� Z,d� Z- d6d!�Z. d6d"�Z/e0e1fZ2 G d#� d$e)� � Z3d7d%�Z4d&� Z5d'� Z6d(� Z7d)d*gd+d,gd+d,gd-d.gd/d0gd+d,gd1d2gd3�Z8dS )8at 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)�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__� � �=D:\Python311\Lib\site-packages\google/protobuf/json_format.pyr r N s � � � � � �/�/�/�/r r c � � e Zd ZdZdS )�SerializeToJsonErrorz&Thrown if serialization to JSON fails.Nr r r r r r R s � � � � � �.�.�.�.r r c � � e Zd ZdZdS )�
ParseErrorz Thrown in case of parsing error.Nr r r r r r V 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.
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'