Module Expr Str Assign NameStore Str Import alias ImportFrom alias ClassDef bases NameLoad body Expr Str FunctionDef arguments args NameParam NameParam defaults body Expr Str Assign AttributeStore NameLoad attr Call AttributeLoad NameLoad attr Str Dict Assign AttributeStore NameLoad attr Dict decorator_list FunctionDef arguments args NameParam NameParam NameParam NameParam defaults NameLoad Num body Expr Str If CompareIs NameLoad NameLoad body Assign NameStore ListLoad If CompareIn NameLoad NameLoad body Return BinOpMod Str NameLoad Expr Call AttributeLoad NameLoad attr NameLoad If CompareNotIn NameLoad AttributeLoad NameLoad attr body Assign SubscriptStore AttributeLoad NameLoad attr Index NameLoad Call AttributeLoad Call NameLoad SubscriptLoad AttributeLoad NameLoad attr Index NameLoad NameLoad NameLoad attr AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr Return SubscriptLoad AttributeLoad NameLoad attr Index NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Str Return SubscriptLoad Call AttributeLoad NameLoad attr NameLoad keyword ListLoad keyword Num Slice Num decorator_list FunctionDef arguments args NameParam NameParam NameParam NameParam defaults NameLoad Num body Expr Str If CompareIs NameLoad NameLoad body Assign NameStore ListLoad Return Call AttributeLoad Call NameLoad NameLoad NameLoad NameLoad attr AttributeLoad NameLoad attr decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Str Return SubscriptLoad Call AttributeLoad NameLoad attr NameLoad keyword Num Slice Num decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Str Return SubscriptLoad AttributeLoad NameLoad attr Index NameLoad decorator_list decorator_list ClassDef bases NameLoad body Expr Str FunctionDef arguments args NameParam NameParam NameParam NameParam defaults Num body Expr Str Assign AttributeStore NameLoad attr ListLoad Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Str Expr Call AttributeLoad AttributeLoad NameLoad attr attr ListLoad BinOpMult Str AttributeLoad NameLoad attr NameLoad Str decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Str Expr Call AttributeLoad AttributeLoad NameLoad attr attr ListLoad BinOpMult Str AttributeLoad NameLoad attr NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam defaults body Expr Str If NameLoad body Assign NameStore BinOpAdd BinOpAdd Str BinOpMult Str BinOpAdd AttributeLoad NameLoad attr Num Str Assign NameStore Call AttributeLoad NameLoad attr Assign NameStore ListComp Call AttributeLoad NameLoad attr comprehension NameStore NameLoad Assign NameStore Call AttributeLoad NameLoad attr NameLoad Expr Call AttributeLoad AttributeLoad NameLoad attr attr ListLoad NameLoad Str NameLoad Str orelse Expr Call AttributeLoad AttributeLoad NameLoad attr attr ListLoad NameLoad Str decorator_list FunctionDef arguments args NameParam defaults body Expr Str AugAssignAdd AttributeStore NameLoad attr Num decorator_list FunctionDef arguments args NameParam defaults body Expr Str AugAssignSub AttributeStore NameLoad attr Num decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Str Assign NameStore Call AttributeLoad NameLoad attr Str If CompareEq NameLoad Str body Expr Call AttributeLoad NameLoad attr Str Call AttributeLoad NameLoad attr Str Str Expr Call AttributeLoad NameLoad attr For TupleStore NameStore NameStore Call AttributeLoad Call AttributeLoad NameLoad attr Str Dict attr body Expr Call AttributeLoad NameLoad attr BinOpMod Str NameLoad Expr Call AttributeLoad NameLoad attr NameLoad Expr Call AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr Str orelse If CompareIn Str NameLoad body Assign NameStore SubscriptLoad NameLoad Index Str Assign NameStore Call AttributeLoad NameLoad attr Str Str Assign NameStore Call AttributeLoad NameLoad attr NameLoad AttributeLoad NameLoad attr Assign NameStore Call AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr SubscriptLoad NameLoad Index Num NameLoad For NameStore SubscriptLoad NameLoad Slice Num body Expr Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr orelse If CompareEq NameLoad Str body Assign NameStore Call AttributeLoad NameLoad attr Str Str Expr Call AttributeLoad NameLoad attr BinOpMod Str Call NameLoad NameLoad Call AttributeLoad NameLoad attr Str Str orelse If CompareEq NameLoad Str body Assign NameStore Call AttributeLoad NameLoad attr Str Str Expr Call AttributeLoad NameLoad attr BinOpMod Str Call NameLoad NameLoad Call AttributeLoad NameLoad attr Str Str orelse If CompareEq NameLoad Str body Assign NameStore Call AttributeLoad NameLoad attr Str Str Expr Call AttributeLoad NameLoad attr BinOpMod Str Call NameLoad NameLoad Call AttributeLoad NameLoad attr Str Str orelse If CompareEq NameLoad Str body Assign NameStore Call AttributeLoad NameLoad attr Str Str Expr Call AttributeLoad NameLoad attr BinOpMod Str Call NameLoad NameLoad Call AttributeLoad NameLoad attr Str Str orelse If CompareEq NameLoad Str body Expr Call AttributeLoad NameLoad attr Str Call AttributeLoad NameLoad attr Str Str orelse If CompareEq NameLoad Str body Expr Call AttributeLoad NameLoad attr Str Call AttributeLoad NameLoad attr Str Str orelse If CompareEq NameLoad Str body Expr Call AttributeLoad NameLoad attr Str Call AttributeLoad NameLoad attr Str Expr Call AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr Str Expr Call AttributeLoad NameLoad attr SubscriptLoad NameLoad Index Str Expr Call AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr Str orelse Expr Call AttributeLoad NameLoad attr BinOpMod Str NameLoad Expr Call AttributeLoad NameLoad attr Str Str Assign AttributeStore NameLoad attr Call AttributeLoad Str attr AttributeLoad NameLoad attr Return AttributeLoad NameLoad attr decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Str Assign AttributeStore NameLoad attr NameLoad Return Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr decorator_list decorator_list
N/A N/A Schema processing for discovery based APIs

Schemas holds an APIs discovery schemas. It can return those schema as
deserialized JSON objects, or pretty print them as prototype objects that
conform to the schema.

For example, given the schema:

 schema = """{
   "Foo": {
    "type": "object",
    "properties": {
     "etag": {
      "type": "string",
      "description": "ETag of the collection."
     },
     "kind": {
      "type": "string",
      "description": "Type of the collection ('calendar#acl').",
      "default": "calendar#acl"
     },
     "nextPageToken": {
      "type": "string",
      "description": "Token used to access the next
         page of this result. Omitted if no further results are available."
     }
    }
   }
 }"""

 s = Schemas(schema)
 print s.prettyPrintByName('Foo')

 Produces the following output:

  {
   "nextPageToken": "A String", # Token used to access the
       # next page of this result. Omitted if no further results are available.
   "kind": "A String", # Type of the collection ('calendar#acl').
   "etag": "A String", # ETag of the collection.
  },

The constructor takes a discovery document in which to look up named schema.
 N/A __author__ jcgregorio@google.com (Joe Gregorio) N/A copy oauth2client.anyjson simplejson Schemas N/A object N/A N/A Schemas for an API. __init__ N/A N/A self discovery N/A N/A N/A Constructor.

    Args:
      discovery: object, Deserialized discovery document from which we pull
        out the named schema.
     N/A N/A self schemas N/A N/A discovery get schemas N/A N/A N/A self pretty N/A N/A _prettyPrintByName N/A N/A self name seen dent N/A None 0 N/A N/A Get pretty printed object prototype from the schema name.

    Args:
      name: string, Name of schema in the discovery document.
      seen: list of string, Names of schema already seen. Used to handle
        recursive definitions.

    Returns:
      string, A string that contains a prototype object with
        comments that conforms to the given schema.
     N/A N/A seen None N/A N/A seen N/A N/A N/A name seen N/A N/A N/A # Object with schema name: %s name N/A N/A N/A seen append name N/A N/A name N/A self pretty N/A N/A N/A N/A self pretty N/A name N/A N/A N/A _SchemaToStruct N/A N/A self schemas N/A name seen dent to_str N/A self _prettyPrintByName N/A N/A N/A seen pop N/A N/A N/A self pretty N/A name N/A prettyPrintByName N/A N/A self name N/A N/A N/A Get pretty printed object prototype from the schema name.

    Args:
      name: string, Name of schema in the discovery document.

    Returns:
      string, A string that contains a prototype object with
        comments that conforms to the given schema.
     N/A N/A N/A N/A self _prettyPrintByName name seen N/A dent 1 N/A -2 N/A _prettyPrintSchema N/A N/A self schema seen dent N/A None 0 N/A N/A Get pretty printed object prototype of schema.

    Args:
      schema: object, Parsed JSON schema.
      seen: list of string, Names of schema already seen. Used to handle
        recursive definitions.

    Returns:
      string, A string that contains a prototype object with
        comments that conforms to the given schema.
     N/A N/A seen None N/A N/A seen N/A N/A N/A N/A N/A _SchemaToStruct schema seen dent to_str N/A self _prettyPrintByName N/A prettyPrintSchema N/A N/A self schema N/A N/A N/A Get pretty printed object prototype of schema.

    Args:
      schema: object, Parsed JSON schema.

    Returns:
      string, A string that contains a prototype object with
        comments that conforms to the given schema.
     N/A N/A N/A N/A self _prettyPrintSchema schema dent 1 N/A -2 N/A get N/A N/A self name N/A N/A N/A Get deserialized JSON schema from the schema name.

    Args:
      name: string, Schema name.
     N/A N/A N/A self schemas N/A name N/A N/A _SchemaToStruct N/A object N/A N/A Convert schema to a prototype object. __init__ N/A N/A self schema seen dent N/A 0 N/A N/A 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.
     N/A N/A self value N/A N/A N/A self string None N/A N/A self schema schema N/A N/A self dent dent N/A N/A self from_cache None N/A N/A self seen seen N/A emit N/A N/A self text N/A N/A N/A Add text as a line to the output.

    Args:
      text: string, Text to output.
     N/A N/A N/A N/A self value extend N/A N/A N/A self dent text N/A emitBegin N/A N/A self text N/A N/A N/A Add text to the output, but with no line terminator.

    Args:
      text: string, Text to output.
       N/A N/A N/A N/A self value extend N/A N/A N/A self dent text N/A emitEnd N/A N/A self text comment N/A N/A N/A Add text and comment to the output with line terminator.

    Args:
      text: string, Text to output.
      comment: string, Python comment.
     N/A comment N/A N/A divider N/A N/A N/A N/A N/A self dent 2 #  N/A lines N/A N/A comment splitlines N/A lines N/A N/A N/A x rstrip N/A x lines N/A comment N/A N/A divider join lines N/A N/A N/A N/A self value extend N/A text  #  comment N/A N/A N/A N/A N/A self value extend N/A text N/A indent N/A N/A self N/A N/A N/A Increase indentation level. N/A N/A self dent 1 N/A undent N/A N/A self N/A N/A N/A Decrease indentation level. N/A N/A self dent 1 N/A _to_str_impl N/A N/A self schema N/A N/A N/A 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.
     N/A stype N/A N/A schema get type N/A N/A stype object N/A N/A N/A N/A self emitEnd { N/A N/A schema get description N/A N/A N/A self indent N/A N/A pname pschema N/A N/A N/A N/A schema get properties N/A iteritems N/A N/A N/A N/A self emitBegin N/A "%s":  pname N/A N/A N/A self _to_str_impl pschema N/A N/A N/A self undent N/A N/A N/A self emit }, N/A N/A N/A $ref schema N/A N/A schemaName N/A schema N/A $ref N/A description N/A N/A schema get description N/A s N/A N/A self from_cache schemaName N/A self seen N/A parts N/A N/A s splitlines N/A N/A N/A self emitEnd N/A parts N/A 0 description N/A line N/A parts N/A 1 N/A N/A N/A N/A self emit N/A N/A line rstrip N/A N/A N/A stype boolean N/A N/A value N/A N/A schema get default True or False N/A N/A N/A self emitEnd N/A %s, N/A str value N/A N/A schema get description N/A N/A N/A stype string N/A N/A value N/A N/A schema get default A String N/A N/A N/A self emitEnd N/A "%s", N/A str value N/A N/A schema get description N/A N/A N/A stype integer N/A N/A value N/A N/A schema get default 42 N/A N/A N/A self emitEnd N/A %s, N/A str value N/A N/A schema get description N/A N/A N/A stype number N/A N/A value N/A N/A schema get default 3.14 N/A N/A N/A self emitEnd N/A %s, N/A str value N/A N/A schema get description N/A N/A N/A stype null N/A N/A N/A N/A self emitEnd None, N/A N/A schema get description N/A N/A N/A stype any N/A N/A N/A N/A self emitEnd "", N/A N/A schema get description N/A N/A N/A stype array N/A N/A N/A N/A self emitEnd [ N/A N/A schema get description N/A N/A N/A self indent N/A N/A N/A self emitBegin N/A N/A N/A self _to_str_impl N/A schema N/A items N/A N/A N/A self undent N/A N/A N/A self emit ], N/A N/A N/A N/A self emit N/A Unknown type! %s stype N/A N/A N/A self emitEnd N/A N/A self string N/A N/A join N/A self value N/A N/A self string N/A to_str N/A N/A self from_cache N/A N/A N/A 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.
     N/A N/A self from_cache from_cache N/A N/A N/A self _to_str_impl N/A self schema N/A N/A