Public Member Functions | Public Attributes | Private Member Functions | List of all members
google.protobuf.text_format._Printer Class Reference
Inheritance diagram for google.protobuf.text_format._Printer:
Inheritance graph
[legend]

Public Member Functions

def __init__ (self, out, indent=0, as_utf8=False, as_one_line=False, use_short_repeated_primitives=False, pointy_brackets=False, use_index_order=False, float_format=None, double_format=None, use_field_number=False, descriptor_pool=None, message_formatter=None, print_unknown_fields=False)
 
def __init__ (self, out, indent=0, as_utf8=False, as_one_line=False, use_short_repeated_primitives=False, pointy_brackets=False, use_index_order=False, float_format=None, double_format=None, use_field_number=False, descriptor_pool=None, message_formatter=None, print_unknown_fields=False, force_colon=False)
 
def PrintField (self, field, value)
 
def PrintField (self, field, value)
 
def PrintFieldValue (self, field, value)
 
def PrintFieldValue (self, field, value)
 
def PrintMessage (self, message)
 
def PrintMessage (self, message)
 

Public Attributes

 as_one_line
 
 as_utf8
 
 descriptor_pool
 
 double_format
 
 float_format
 
 force_colon
 
 indent
 
 message_formatter
 
 out
 
 pointy_brackets
 
 print_unknown_fields
 
 use_field_number
 
 use_index_order
 
 use_short_repeated_primitives
 

Private Member Functions

def _PrintFieldName (self, field)
 
def _PrintFieldName (self, field)
 
def _PrintMessageFieldValue (self, value)
 
def _PrintMessageFieldValue (self, value)
 
def _PrintShortRepeatedPrimitivesValue (self, field, value)
 
def _PrintShortRepeatedPrimitivesValue (self, field, value)
 
def _PrintUnknownFields (self, unknown_fields)
 
def _PrintUnknownFields (self, unknown_fields)
 
def _TryCustomFormatMessage (self, message)
 
def _TryCustomFormatMessage (self, message)
 
def _TryPrintAsAnyMessage (self, message)
 
def _TryPrintAsAnyMessage (self, message)
 

Detailed Description

Text format printer for protocol message.

Definition at line 310 of file bloaty/third_party/protobuf/python/google/protobuf/text_format.py.

Constructor & Destructor Documentation

◆ __init__() [1/2]

def google.protobuf.text_format._Printer.__init__ (   self,
  out,
  indent = 0,
  as_utf8 = False,
  as_one_line = False,
  use_short_repeated_primitives = False,
  pointy_brackets = False,
  use_index_order = False,
  float_format = None,
  double_format = None,
  use_field_number = False,
  descriptor_pool = None,
  message_formatter = None,
  print_unknown_fields = False 
)
Initialize the Printer.

Double values can be formatted compactly with 15 digits of precision
(which is the most that IEEE 754 "double" can guarantee) using
double_format='.15g'. To ensure that converting to text and back to a proto
will result in an identical value, double_format='.17g' should be used.

Args:
  out: To record the text format result.
  indent: The initial indent level for pretty print.
  as_utf8: Return unescaped Unicode for non-ASCII characters.
  In Python 3 actual Unicode characters may appear as is in strings.
  In Python 2 the return value will be valid UTF-8 rather than ASCII.
  as_one_line: Don't introduce newlines between fields.
  use_short_repeated_primitives: Use short repeated format for primitives.
  pointy_brackets: If True, use angle brackets instead of curly braces for
nesting.
  use_index_order: If True, print fields of a proto message using the order
defined in source code instead of the field number. By default, use the
field number order.
  float_format: If set, use this to specify float field formatting
(per the "Format Specification Mini-Language"); otherwise, 8 valid
digits is used (default '.8g'). Also affect double field if
double_format is not set but float_format is set.
  double_format: If set, use this to specify double field formatting
(per the "Format Specification Mini-Language"); if it is not set but
float_format is set, use float_format. Otherwise, str() is used.
  use_field_number: If True, print field numbers instead of names.
  descriptor_pool: A DescriptorPool used to resolve Any types.
  message_formatter: A function(message, indent, as_one_line): unicode|None
to custom format selected sub-messages (usually based on message type).
Use to pretty print parts of the protobuf for easier diffing.
  print_unknown_fields: If True, unknown fields will be printed.

Definition at line 313 of file bloaty/third_party/protobuf/python/google/protobuf/text_format.py.

◆ __init__() [2/2]

def google.protobuf.text_format._Printer.__init__ (   self,
  out,
  indent = 0,
  as_utf8 = False,
  as_one_line = False,
  use_short_repeated_primitives = False,
  pointy_brackets = False,
  use_index_order = False,
  float_format = None,
  double_format = None,
  use_field_number = False,
  descriptor_pool = None,
  message_formatter = None,
  print_unknown_fields = False,
  force_colon = False 
)
Initialize the Printer.

Double values can be formatted compactly with 15 digits of precision
(which is the most that IEEE 754 "double" can guarantee) using
double_format='.15g'. To ensure that converting to text and back to a proto
will result in an identical value, double_format='.17g' should be used.

Args:
  out: To record the text format result.
  indent: The initial indent level for pretty print.
  as_utf8: Return unescaped Unicode for non-ASCII characters.
  In Python 3 actual Unicode characters may appear as is in strings.
  In Python 2 the return value will be valid UTF-8 rather than ASCII.
  as_one_line: Don't introduce newlines between fields.
  use_short_repeated_primitives: Use short repeated format for primitives.
  pointy_brackets: If True, use angle brackets instead of curly braces for
nesting.
  use_index_order: If True, print fields of a proto message using the order
defined in source code instead of the field number. By default, use the
field number order.
  float_format: If set, use this to specify float field formatting
(per the "Format Specification Mini-Language"); otherwise, shortest
float that has same value in wire will be printed. Also affect double
field if double_format is not set but float_format is set.
  double_format: If set, use this to specify double field formatting
(per the "Format Specification Mini-Language"); if it is not set but
float_format is set, use float_format. Otherwise, str() is used.
  use_field_number: If True, print field numbers instead of names.
  descriptor_pool: A DescriptorPool used to resolve Any types.
  message_formatter: A function(message, indent, as_one_line): unicode|None
to custom format selected sub-messages (usually based on message type).
Use to pretty print parts of the protobuf for easier diffing.
  print_unknown_fields: If True, unknown fields will be printed.
  force_colon: If set, a colon will be added after the field name even if
the field is a proto message.

Definition at line 323 of file protobuf/python/google/protobuf/text_format.py.

Member Function Documentation

◆ _PrintFieldName() [1/2]

def google.protobuf.text_format._Printer._PrintFieldName (   self,
  field 
)
private
Print field name.

Definition at line 498 of file bloaty/third_party/protobuf/python/google/protobuf/text_format.py.

◆ _PrintFieldName() [2/2]

def google.protobuf.text_format._Printer._PrintFieldName (   self,
  field 
)
private
Print field name.

Definition at line 514 of file protobuf/python/google/protobuf/text_format.py.

◆ _PrintMessageFieldValue() [1/2]

def google.protobuf.text_format._Printer._PrintMessageFieldValue (   self,
  value 
)
private

◆ _PrintMessageFieldValue() [2/2]

def google.protobuf.text_format._Printer._PrintMessageFieldValue (   self,
  value 
)
private

◆ _PrintShortRepeatedPrimitivesValue() [1/2]

def google.protobuf.text_format._Printer._PrintShortRepeatedPrimitivesValue (   self,
  field,
  value 
)
private

◆ _PrintShortRepeatedPrimitivesValue() [2/2]

def google.protobuf.text_format._Printer._PrintShortRepeatedPrimitivesValue (   self,
  field,
  value 
)
private
"Prints short repeated primitives value.

Definition at line 550 of file protobuf/python/google/protobuf/text_format.py.

◆ _PrintUnknownFields() [1/2]

def google.protobuf.text_format._Printer._PrintUnknownFields (   self,
  unknown_fields 
)
private
Print unknown fields.

Definition at line 443 of file bloaty/third_party/protobuf/python/google/protobuf/text_format.py.

◆ _PrintUnknownFields() [2/2]

def google.protobuf.text_format._Printer._PrintUnknownFields (   self,
  unknown_fields 
)
private
Print unknown fields.

Definition at line 459 of file protobuf/python/google/protobuf/text_format.py.

◆ _TryCustomFormatMessage() [1/2]

def google.protobuf.text_format._Printer._TryCustomFormatMessage (   self,
  message 
)
private

◆ _TryCustomFormatMessage() [2/2]

def google.protobuf.text_format._Printer._TryCustomFormatMessage (   self,
  message 
)
private

◆ _TryPrintAsAnyMessage() [1/2]

def google.protobuf.text_format._Printer._TryPrintAsAnyMessage (   self,
  message 
)
private
Serializes if message is a google.protobuf.Any field.

Definition at line 378 of file bloaty/third_party/protobuf/python/google/protobuf/text_format.py.

◆ _TryPrintAsAnyMessage() [2/2]

def google.protobuf.text_format._Printer._TryPrintAsAnyMessage (   self,
  message 
)
private
Serializes if message is a google.protobuf.Any field.

Definition at line 393 of file protobuf/python/google/protobuf/text_format.py.

◆ PrintField() [1/2]

def google.protobuf.text_format._Printer.PrintField (   self,
  field,
  value 
)
Print a single field name/value pair.

Definition at line 525 of file bloaty/third_party/protobuf/python/google/protobuf/text_format.py.

◆ PrintField() [2/2]

def google.protobuf.text_format._Printer.PrintField (   self,
  field,
  value 
)
Print a single field name/value pair.

Definition at line 543 of file protobuf/python/google/protobuf/text_format.py.

◆ PrintFieldValue() [1/2]

def google.protobuf.text_format._Printer.PrintFieldValue (   self,
  field,
  value 
)
Print a single field value (not including name).

For repeated fields, the value should be a single element.

Args:
  field: The descriptor of the field to be printed.
  value: The value of the field.

Definition at line 562 of file bloaty/third_party/protobuf/python/google/protobuf/text_format.py.

◆ PrintFieldValue() [2/2]

def google.protobuf.text_format._Printer.PrintFieldValue (   self,
  field,
  value 
)
Print a single field value (not including name).

For repeated fields, the value should be a single element.

Args:
  field: The descriptor of the field to be printed.
  value: The value of the field.

Definition at line 581 of file protobuf/python/google/protobuf/text_format.py.

◆ PrintMessage() [1/2]

def google.protobuf.text_format._Printer.PrintMessage (   self,
  message 
)
Convert protobuf message to text format.

Args:
  message: The protocol buffers message.

Definition at line 404 of file bloaty/third_party/protobuf/python/google/protobuf/text_format.py.

◆ PrintMessage() [2/2]

def google.protobuf.text_format._Printer.PrintMessage (   self,
  message 
)
Convert protobuf message to text format.

Args:
  message: The protocol buffers message.

Definition at line 420 of file protobuf/python/google/protobuf/text_format.py.

Member Data Documentation

◆ as_one_line

google.protobuf.text_format._Printer.as_one_line

◆ as_utf8

google.protobuf.text_format._Printer.as_utf8

◆ descriptor_pool

google.protobuf.text_format._Printer.descriptor_pool

◆ double_format

google.protobuf.text_format._Printer.double_format

◆ float_format

google.protobuf.text_format._Printer.float_format

◆ force_colon

google.protobuf.text_format._Printer.force_colon

◆ indent

google.protobuf.text_format._Printer.indent

◆ message_formatter

google.protobuf.text_format._Printer.message_formatter

◆ out

google.protobuf.text_format._Printer.out

◆ pointy_brackets

google.protobuf.text_format._Printer.pointy_brackets

◆ print_unknown_fields

google.protobuf.text_format._Printer.print_unknown_fields

◆ use_field_number

google.protobuf.text_format._Printer.use_field_number

◆ use_index_order

google.protobuf.text_format._Printer.use_index_order

◆ use_short_repeated_primitives

google.protobuf.text_format._Printer.use_short_repeated_primitives

The documentation for this class was generated from the following file:


grpc
Author(s):
autogenerated on Fri May 16 2025 03:03:29