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)
 

Properties

 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 swagger_model.py.

Constructor & Destructor Documentation

◆ __init__()

def __init__ (   self,
  swagger_version,
  stack 
)

Definition at line 89 of file swagger_model.py.

References ParsingContext.__stack, and ParsingContext.__swagger_version.

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

Member Function Documentation

◆ __repr__()

def __repr__ (   self)

Definition at line 93 of file swagger_model.py.

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)
96 

◆ get_stack()

def get_stack (   self)

Definition at line 100 of file swagger_model.py.

References ParsingContext.__stack.

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

◆ get_swagger_version()

def get_swagger_version (   self)

Definition at line 97 of file swagger_model.py.

References ParsingContext.__swagger_version.

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

◆ next()

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

◆ next_stack()

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 110 of file swagger_model.py.

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.
112 
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)
121 
const char * str
Definition: app_jack.c:147

◆ version_less_than()

def version_less_than (   self,
  ver 
)

Definition at line 107 of file swagger_model.py.

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
109 
def compare_versions(lhs, rhs)

Property Documentation

◆ stack

stack = property(get_stack)
static

◆ swagger_version

swagger_version = property(get_swagger_version)
static

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