Asterisk - The Open Source Telephony Project  GIT-master-b7027de
Public Member Functions | Properties
ParsingContext Class Reference

Inherits object.

Public Member Functions

def __init__ (self, swagger_version, stack)
def __repr__ (self)
def get_stack (self)
def get_swagger_version (self)
def next (self, version=None, stack=None)
def next_stack (self, json, id_field)
def version_less_than (self, ver)


 stack = property(get_stack)
 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 82 of file

Constructor & Destructor Documentation

◆ __init__()

def __init__ (   self,

Definition at line 89 of file

References ParsingContext.__stack, and ParsingContext.__swagger_version.

89  def __init__(self, swagger_version, stack):
90  self.__swagger_version = swagger_version
91  self.__stack = stack

Member Function Documentation

◆ __repr__()

def __repr__ (   self)

Definition at line 93 of file

References ParsingContext.stack, ast_xmpp_client.stack, and ParsingContext.swagger_version.

93  def __repr__(self):
94  return "ParsingContext(swagger_version=%s, stack=%s)" % (
95  self.swagger_version, self.stack)

◆ get_stack()

def get_stack (   self)

Definition at line 100 of file

References ParsingContext.__stack.

100  def get_stack(self):
101  return self.__stack

◆ get_swagger_version()

def get_swagger_version (   self)

Definition at line 97 of file

References ParsingContext.__swagger_version.

97  def get_swagger_version(self):
98  return self.__swagger_version

◆ next()

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

◆ next_stack()

def next_stack (   self,
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 110 of file

References ParsingContext.stack, ast_xmpp_client.stack, str, and ParsingContext.swagger_version.

110  def next_stack(self, json, id_field):
111  """Returns a new item pushed to the stack.
113  @param json: Current JSON object.
114  @param id_field: Field identifying this object.
115  @return New context with additional item in the stack.
116  """
117  if not id_field in json:
118  raise SwaggerError("Missing id_field: %s" % id_field, self)
119  new_stack = self.stack + ['%s=%s' % (id_field, str(json[id_field]))]
120  return ParsingContext(self.swagger_version, new_stack)
const char * str
Definition: app_jack.c:147

◆ version_less_than()

def version_less_than (   self,

Definition at line 107 of file

References swagger_model.compare_versions(), and ParsingContext.swagger_version.

107  def version_less_than(self, ver):
108  return compare_versions(self.swagger_version, ver) < 0
def compare_versions(lhs, rhs)

Property Documentation

◆ stack

stack = property(get_stack)

◆ swagger_version

swagger_version = property(get_swagger_version)

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