Asterisk - The Open Source Telephony Project GIT-master-a358458
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 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.

34def 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

Referenced by PathSegment.get_child().

◆ snakify()

def 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.

54def 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 == '-':
64 c = '_'
65 prior_lower = c.islower()
66 r += c.lower()
67 return r
68
69

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

◆ wikify()

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

@param str: String to escape

Definition at line 44 of file asterisk_processor.py.

44def 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

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