Asterisk - The Open Source Telephony Project  18.5.0
Data Structures | Functions
asterisk_processor Namespace Reference

Data Structures

class  AsteriskProcessor
 
class  PathSegment
 

Functions

def simple_name (name)
 
def snakify (name)
 
def wikify (str)
 

Function Documentation

◆ simple_name()

def asterisk_processor.simple_name (   name)
Removes the {markers} from a path segement.

@param name: Swagger path segement, with {pathVar} markers.

Definition at line 34 of file asterisk_processor.py.

Referenced by PathSegment.get_child().

34 def simple_name(name):
35  """Removes the {markers} from a path segement.
36 
37  @param name: Swagger path segement, with {pathVar} markers.
38  """
39  if name.startswith('{') and name.endswith('}'):
40  return name[1:-1]
41  return name
42 
43 

◆ snakify()

def asterisk_processor.snakify (   name)
Helper to take a camelCase or dash-seperated name and make it
snake_case.

Definition at line 54 of file asterisk_processor.py.

Referenced by AsteriskProcessor.process_model(), AsteriskProcessor.process_operation(), AsteriskProcessor.process_parameter(), AsteriskProcessor.process_resource_api(), and AsteriskProcessor.process_type().

54 def snakify(name):
55  """Helper to take a camelCase or dash-seperated name and make it
56  snake_case.
57  """
58  r = ''
59  prior_lower = False
60  for c in name:
61  if c.isupper() and prior_lower:
62  r += "_"
63  if c is '-':
64  c = '_'
65  prior_lower = c.islower()
66  r += c.lower()
67  return r
68 
69 

◆ wikify()

def asterisk_processor.wikify (   str)
Escapes a string for the wiki.

@param str: String to escape

Definition at line 44 of file asterisk_processor.py.

Referenced by AsteriskProcessor.process_api(), AsteriskProcessor.process_model(), AsteriskProcessor.process_operation(), AsteriskProcessor.process_parameter(), AsteriskProcessor.process_property(), and AsteriskProcessor.process_type().

44 def wikify(str):
45  """Escapes a string for the wiki.
46 
47  @param str: String to escape
48  """
49  # Replace all line breaks with line feeds
50  str = re.sub(r'<br\s*/?>', '\n', str)
51  return re.sub(r'([{}\[\]])', r'\\\1', str)
52 
53