ParsingContext Class Reference


Public Member Functions

def __init__
def __repr__
def get_stack
def get_swagger_version
def next
def next_stack
def version_less_than

Static Public Attributes

tuple stack = property(get_stack)
tuple swagger_version = property(get_swagger_version)

Detailed Description

Context information for parsing.

This object is immutable. To change contexts (like adding an item to the
stack), use the next() and next_stack() functions to build a new one.

Definition at line 81 of file swagger_model.py.


Member Function Documentation

def __init__ (   self,
  swagger_version,
  stack 
)

Definition at line 88 of file swagger_model.py.

00088                                               :
00089         self.__swagger_version = swagger_version
00090         self.__stack = stack
00091 
    def __repr__(self):

def __repr__ (   self  ) 

Definition at line 92 of file swagger_model.py.

00092                       :
00093         return "ParsingContext(swagger_version=%s, stack=%s)" % (
00094             self.swagger_version, self.stack)
00095 
    def get_swagger_version(self):

def get_stack (   self  ) 

Definition at line 99 of file swagger_model.py.

00099                        :
00100         return self.__stack
00101 
    swagger_version = property(get_swagger_version)

def get_swagger_version (   self  ) 

Definition at line 96 of file swagger_model.py.

00096                                  :
00097         return self.__swagger_version
00098 
    def get_stack(self):

def next (   self,
  version = None,
  stack = None 
)

Definition at line 121 of file swagger_model.py.

00121                                             :
00122         if version is None:
00123             version = self.version
00124         if stack is None:
00125             stack = self.stack
00126         return ParsingContext(version, stack)
00127 
00128 
class SwaggerError(Exception):

def next_stack (   self,
  json,
  id_field 
)

Returns a new item pushed to the stack.

@param json: Current JSON object.
@param id_field: Field identifying this object.
@return New context with additional item in the stack.

Definition at line 109 of file swagger_model.py.

00109                                         :
00110         """Returns a new item pushed to the stack.
00111 
00112         @param json: Current JSON object.
00113         @param id_field: Field identifying this object.
00114         @return New context with additional item in the stack.
00115         """
00116         if not id_field in json:
00117             raise SwaggerError("Missing id_field: %s" % id_field, self)
00118         new_stack = self.stack + ['%s=%s' % (id_field, str(json[id_field]))]
00119         return ParsingContext(self.swagger_version, new_stack)
00120 
    def next(self, version=None, stack=None):

def version_less_than (   self,
  ver 
)

Definition at line 106 of file swagger_model.py.

00106                                     :
00107         return compare_versions(self.swagger_version, ver) < 0
00108 
    def next_stack(self, json, id_field):


Field Documentation

tuple stack = property(get_stack) [static]

Definition at line 104 of file swagger_model.py.

tuple swagger_version = property(get_swagger_version) [static]

Definition at line 102 of file swagger_model.py.


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

Generated on Thu Apr 16 06:41:40 2015 for Asterisk - The Open Source Telephony Project by  doxygen 1.5.6