recur_matcher didnt belong in depricated
This commit is contained in:
parent
268991de18
commit
25028b6df2
|
|
@ -88,6 +88,31 @@ def clean(st):
|
|||
|
||||
|
||||
|
||||
def recur_matcher(item, depth=0):
|
||||
indent = depth * " "
|
||||
my_result_lines = []
|
||||
if type(item) == type({}):
|
||||
if not match( item,
|
||||
{'entityMetadata': {'entityTitle': _,'status': _, 'entityType':_, 'entityId':_ }},
|
||||
lambda title,status,typ,id:
|
||||
my_result_lines.append("%s%s: %s (id %s) status: %s" % (indent, str(typ), str(title), str(id), str(status))) ,
|
||||
{'attributes': {'displayName': _}, 'lookUpDisplay': _, },
|
||||
lambda x,y: my_result_lines.append("%s%s: %s" % (indent, clean(str(x)), clean(str(y)))) ,
|
||||
{'attributes': {'displayName': _}, 'fieldValue': _, },
|
||||
lambda x,y: my_result_lines.append("%s%s: %s" % (indent, clean(str(x)), clean(str(y)))) ,
|
||||
{'sectionName': _},
|
||||
lambda x: my_result_lines.append("%sSection: %s" % (indent, str(x))) ,
|
||||
_, nothing
|
||||
):
|
||||
for K,V in list(item.items()):
|
||||
my_result_lines.extend(recur_matcher(V,depth+1))
|
||||
elif type(item) == type([]):
|
||||
for V in item:
|
||||
my_result_lines.extend(recur_matcher(V,depth+1))
|
||||
return my_result_lines
|
||||
|
||||
|
||||
|
||||
num_failed_course = 1
|
||||
|
||||
def single_course_parse(c):
|
||||
|
|
|
|||
|
|
@ -368,31 +368,6 @@ def sampleclass():
|
|||
|
||||
|
||||
|
||||
def recur_matcher(item, depth=0):
|
||||
indent = depth * " "
|
||||
my_result_lines = []
|
||||
if type(item) == type({}):
|
||||
if not match( item,
|
||||
{'entityMetadata': {'entityTitle': _,'status': _, 'entityType':_, 'entityId':_ }},
|
||||
lambda title,status,typ,id:
|
||||
my_result_lines.append("%s%s: %s (id %s) status: %s" % (indent, str(typ), str(title), str(id), str(status))) ,
|
||||
{'attributes': {'displayName': _}, 'lookUpDisplay': _, },
|
||||
lambda x,y: my_result_lines.append("%s%s: %s" % (indent, clean(str(x)), clean(str(y)))) ,
|
||||
{'attributes': {'displayName': _}, 'fieldValue': _, },
|
||||
lambda x,y: my_result_lines.append("%s%s: %s" % (indent, clean(str(x)), clean(str(y)))) ,
|
||||
{'sectionName': _},
|
||||
lambda x: my_result_lines.append("%sSection: %s" % (indent, str(x))) ,
|
||||
_, nothing
|
||||
):
|
||||
for K,V in list(item.items()):
|
||||
my_result_lines.extend(recur_matcher(V,depth+1))
|
||||
elif type(item) == type([]):
|
||||
for V in item:
|
||||
my_result_lines.extend(recur_matcher(V,depth+1))
|
||||
return my_result_lines
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
def matchstyle():
|
||||
|
|
|
|||
Loading…
Reference in New Issue