webkit  2cdf99a9e3038c7e01b3c37e8ad903ecbe5eecf1
https://github.com/WebKit/webkit
Classes | Functions | Variables
google.protobuf.text_format Namespace Reference

Classes

class  _Parser
 
class  _Printer
 
class  _Tokenizer
 
class  Error
 
class  ParseError
 
class  TextWriter
 

Functions

def MessageToString (message, as_utf8=False, as_one_line=False, pointy_brackets=False, use_index_order=False, float_format=None, use_field_number=False)
 
def PrintMessage (message, out, indent=0, as_utf8=False, as_one_line=False, pointy_brackets=False, use_index_order=False, float_format=None, use_field_number=False)
 
def PrintField (field, value, out, indent=0, as_utf8=False, as_one_line=False, pointy_brackets=False, use_index_order=False, float_format=None)
 
def PrintFieldValue (field, value, out, indent=0, as_utf8=False, as_one_line=False, pointy_brackets=False, use_index_order=False, float_format=None)
 
def Parse (text, message, allow_unknown_extension=False, allow_field_number=False)
 
def Merge (text, message, allow_unknown_extension=False, allow_field_number=False)
 
def ParseLines (lines, message, allow_unknown_extension=False, allow_field_number=False)
 
def MergeLines (lines, message, allow_unknown_extension=False, allow_field_number=False)
 
def ParseInteger (text, is_signed=False, is_long=False)
 
def ParseFloat (text)
 
def ParseBool (text)
 
def ParseEnum (field, value)
 

Variables

 long = int
 

Function Documentation

◆ Merge()

def google.protobuf.text_format.Merge (   text,
  message,
  allow_unknown_extension = False,
  allow_field_number = False 
)
Parses an text representation of a protocol message into a message.

Like Parse(), but allows repeated values for a non-repeated field, and uses
the last one.

Args:
  text: Message text representation.
  message: A protocol buffer message to merge into.
  allow_unknown_extension: if True, skip over missing extensions and keep
    parsing
  allow_field_number: if True, both field number and field name are allowed.

Returns:
  The same message passed as argument.

Raises:
  ParseError: On text parsing problems.

◆ MergeLines()

def google.protobuf.text_format.MergeLines (   lines,
  message,
  allow_unknown_extension = False,
  allow_field_number = False 
)
Parses an text representation of a protocol message into a message.

Args:
  lines: An iterable of lines of a message's text representation.
  message: A protocol buffer message to merge into.
  allow_unknown_extension: if True, skip over missing extensions and keep
    parsing
  allow_field_number: if True, both field number and field name are allowed.

Returns:
  The same message passed as argument.

Raises:
  ParseError: On text parsing problems.

◆ MessageToString()

def google.protobuf.text_format.MessageToString (   message,
  as_utf8 = False,
  as_one_line = False,
  pointy_brackets = False,
  use_index_order = False,
  float_format = None,
  use_field_number = False 
)
Convert protobuf message to text format.

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

Args:
  message: The protocol buffers message.
  as_utf8: Produce text output in UTF8 format.
  as_one_line: Don't introduce newlines between fields.
  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 floating point number formatting
    (per the "Format Specification Mini-Language"); otherwise, str() is used.
  use_field_number: If True, print field numbers instead of names.

Returns:
  A string of the text formatted protocol buffer message.

◆ Parse()

def google.protobuf.text_format.Parse (   text,
  message,
  allow_unknown_extension = False,
  allow_field_number = False 
)
Parses an text representation of a protocol message into a message.

Args:
  text: Message text representation.
  message: A protocol buffer message to merge into.
  allow_unknown_extension: if True, skip over missing extensions and keep
    parsing
  allow_field_number: if True, both field number and field name are allowed.

Returns:
  The same message passed as argument.

Raises:
  ParseError: On text parsing problems.

◆ ParseBool()

def google.protobuf.text_format.ParseBool (   text)
Parse a boolean value.

Args:
  text: Text to parse.

Returns:
  Boolean values parsed

Raises:
  ValueError: If text is not a valid boolean.

◆ ParseEnum()

def google.protobuf.text_format.ParseEnum (   field,
  value 
)
Parse an enum value.

The value can be specified by a number (the enum value), or by
a string literal (the enum name).

Args:
  field: Enum field descriptor.
  value: String value.

Returns:
  Enum value number.

Raises:
  ValueError: If the enum value could not be parsed.

◆ ParseFloat()

def google.protobuf.text_format.ParseFloat (   text)
Parse a floating point number.

Args:
  text: Text to parse.

Returns:
  The number parsed.

Raises:
  ValueError: If a floating point number couldn't be parsed.

◆ ParseInteger()

def google.protobuf.text_format.ParseInteger (   text,
  is_signed = False,
  is_long = False 
)
Parses an integer.

Args:
  text: The text to parse.
  is_signed: True if a signed integer must be parsed.
  is_long: True if a long integer must be parsed.

Returns:
  The integer value.

Raises:
  ValueError: Thrown Iff the text is not a valid integer.

◆ ParseLines()

def google.protobuf.text_format.ParseLines (   lines,
  message,
  allow_unknown_extension = False,
  allow_field_number = False 
)
Parses an text representation of a protocol message into a message.

Args:
  lines: An iterable of lines of a message's text representation.
  message: A protocol buffer message to merge into.
  allow_unknown_extension: if True, skip over missing extensions and keep
    parsing
  allow_field_number: if True, both field number and field name are allowed.

Returns:
  The same message passed as argument.

Raises:
  ParseError: On text parsing problems.

◆ PrintField()

def google.protobuf.text_format.PrintField (   field,
  value,
  out,
  indent = 0,
  as_utf8 = False,
  as_one_line = False,
  pointy_brackets = False,
  use_index_order = False,
  float_format = None 
)
Print a single field name/value pair.

◆ PrintFieldValue()

def google.protobuf.text_format.PrintFieldValue (   field,
  value,
  out,
  indent = 0,
  as_utf8 = False,
  as_one_line = False,
  pointy_brackets = False,
  use_index_order = False,
  float_format = None 
)
Print a single field value (not including name).

◆ PrintMessage()

def google.protobuf.text_format.PrintMessage (   message,
  out,
  indent = 0,
  as_utf8 = False,
  as_one_line = False,
  pointy_brackets = False,
  use_index_order = False,
  float_format = None,
  use_field_number = False 
)

Variable Documentation

◆ long

google.protobuf.text_format.long = int