Package googleapiclient :: Module schema :: Class _SchemaToStruct |
[hide private]
[frames] | no frames]

# Class _SchemaToStruct

source code

    Convert schema to a prototype object.

Instance Methods | [hide private]
__init__(self, schema, seen, dent=0) Constructor. | source code
emit(self, text) Add text as a line to the output. | source code
emitBegin(self, text) Add text to the output, but with no line terminator. | source code
emitEnd(self, text, comment) Add text and comment to the output with line terminator. | source code
indent(self) Increase indentation level. | source code
undent(self) Decrease indentation level. | source code
_to_str_impl(self, schema) Prototype object based on the schema, in Python code with comments. | source code
to_str(self, from_cache) Prototype object based on the schema, in Python code with comments. | source code
Inherited from `object`: `__delattr__`, `__format__`, `__getattribute__`, `__hash__`, `__new__`, `__reduce__`, `__reduce_ex__`, `__repr__`, `__setattr__`, `__sizeof__`, `__str__`, `__subclasshook__`

Properties | [hide private]
Inherited from `object`: `__class__`

Method Details | [hide private]

### __init__(self, schema, seen, dent=0) (Constructor) | source code
    Constructor.

    Args:
      schema: object, Parsed JSON schema.
      seen: list, List of names of schema already seen while parsing. Used to
        handle recursive definitions.
      dent: int, Initial indentation depth.
Decorators: `@util.positional(3)` Overrides: object.__init__

### emit(self, text) | source code
    Add text as a line to the output.

    Args:
      text: string, Text to output.

### emitBegin(self, text) | source code
    Add text to the output, but with no line terminator.

    Args:
      text: string, Text to output.

### emitEnd(self, text, comment) | source code
    Add text and comment to the output with line terminator.

    Args:
      text: string, Text to output.
      comment: string, Python comment.

### _to_str_impl(self, schema) | source code
    Prototype object based on the schema, in Python code with comments.

    Args:
      schema: object, Parsed JSON schema file.

    Returns:
      Prototype object based on the schema, in Python code with comments.

### to_str(self, from_cache) | source code
    Prototype object based on the schema, in Python code with comments.

    Args:
      from_cache: callable(name, seen), Callable that retrieves an object
         prototype for a schema with the given name. Seen is a list of schema
         names already seen as we recursively descend the schema definition.

    Returns:
      Prototype object based on the schema, in Python code with comments.
      The lines of the code will all be properly indented.