Fix the code to work with Python2.6
It was previously using some features introduced in Python2.7. Change-Id: I3b4b2895f231cf98235efd16f65eb123db8a9157
This commit is contained in:
parent
7266f9e7db
commit
9ad4e8f5fe
@ -30,7 +30,7 @@ def generate_id(path, method):
|
||||
path = path.replace('(', '')
|
||||
path = path.replace(')', '')
|
||||
elems = path.split('/')
|
||||
elems = filter(lambda x: x, elems) # Remove empty strings
|
||||
elems = list(filter(lambda x: x, elems)) # Remove empty strings
|
||||
elems = elems[1:] # Remove "vx" (v1, v2...)
|
||||
|
||||
n_elems = len(elems)
|
||||
@ -189,12 +189,12 @@ class MyNodeVisitor(SparseNodeVisitor):
|
||||
self.in_method_definition = False
|
||||
|
||||
def visit_desc(self, node):
|
||||
attrs = {k: v for (k, v) in node.attlist()}
|
||||
attrs = dict(node.attlist())
|
||||
if attrs['domain'] == 'http':
|
||||
self.in_method_definition = True
|
||||
|
||||
def visit_desc_signature(self, node):
|
||||
attrs = {k: v for (k, v) in node.attlist()}
|
||||
attrs = dict(node.attlist())
|
||||
if 'method' in attrs and 'path' in attrs:
|
||||
method_id = generate_id(attrs['path'], attrs['method'])
|
||||
self.current_method = ET.Element('method', {
|
||||
|
Loading…
x
Reference in New Issue
Block a user