recur_matcher didnt belong in depricated

This commit is contained in:
phowell 2023-03-23 11:48:10 -07:00
parent 268991de18
commit 25028b6df2
2 changed files with 25 additions and 25 deletions

View File

@ -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 num_failed_course = 1
def single_course_parse(c): def single_course_parse(c):

View File

@ -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(): def matchstyle():