autopep8 -i

This commit is contained in:
Costa Shulyupin 2020-07-20 21:31:20 +03:00
parent 484db0dedc
commit 8af8935cb1
1 changed files with 49 additions and 43 deletions

View File

@ -79,6 +79,7 @@ verbose = False
files = collections.defaultdict(list)
def print_limited(a, out=None):
out = out if out else sys.stdout
out.write(str(a) + '\n')
@ -170,7 +171,7 @@ def func_referrers_git_grep(name):
r = extract_referrer(line)
# r is list of file line func
if verbose and r:
print("%-40s\t%s"%(("%s:%s"%(r[0],r[1])),r[2]))
print("%-40s\t%s" % (("%s:%s" % (r[0], r[1])), r[2]))
return res
@ -190,7 +191,8 @@ def func_referrers_cscope(name):
log(l)
m = re.match(r'([^ ]*) ([^ ]*) ([^ ]*) (.*)', l)
file, func, line_num, line_str = m.groups()
if func in ignores: continue
if func in ignores:
continue
res.append([file, line_num, func])
if not res and len(name) > 3:
log(name)
@ -234,12 +236,13 @@ def referrers_tree(name, referrer=None, printed=None, level=0):
name = a[2]
referrers_tree(name, referrer, printed, level + 1)
def referrers(name):
'''
Arg: <identifier>
Ex: nfs_root_data
'''
#for a in func_referrers_git_grep(name):
# for a in func_referrers_git_grep(name):
# print("%s:%s: %s"%(a[0],a[1],a[2]))
print(' '.join([a[2] for a in func_referrers_git_grep(name)]))
@ -488,6 +491,7 @@ def most_used(dg, ins=10, outs=10):
def starts(dg): # roots
return {n: dg.out_degree(n) for (n, d) in dg.in_degree if not d}
def exclude(i, excludes=[], ignores=ignores):
if i in ignores:
return True
@ -495,7 +499,8 @@ def exclude(i, excludes=[], ignores=ignores):
if re.match(e, i):
return True
def digraph_predecessors(dg, starts, levels = 100, excludes = [], ignores=ignores):
def digraph_predecessors(dg, starts, levels=100, excludes=[], ignores=ignores):
dg = to_dg(dg)
passed = set()
# for i in [_ for _ in dg.predecessors(start)]:
@ -503,8 +508,8 @@ def digraph_predecessors(dg, starts, levels = 100, excludes = [], ignores=ignore
for e in excludes:
log(e)
while levels:
#log(levels)
#log(starts)
# log(levels)
# log(starts)
s2 = starts
starts = set()
for s in s2:
@ -514,7 +519,7 @@ def digraph_predecessors(dg, starts, levels = 100, excludes = [], ignores=ignore
passed.add(i)
starts.add(i)
p.add_edge(i, s)
levels-=1
levels -= 1
return p
@ -575,7 +580,7 @@ def digraph_print(dg, starts=None, dst_fn=None, sort=False):
if outs:
s += ' ...' if level > level_limit - 2 else ''
else:
s+=' @' + path
s += ' @' + path
print_limited(level*'\t' + str(node) + s, dst)
printed.add(node)
if level > level_limit - 2:
@ -1131,7 +1136,7 @@ def doxygen(*input):
'''
log(' '.join([i for i in input]))
p = run(['doxygen', '-'], stdout=PIPE,
input = "INPUT=" + ' '.join([i for i in input]) + """
input="INPUT=" + ' '.join([i for i in input]) + """
EXCLUDE_SYMBOLS=*310* *311* SOC_ENUM_SINGLE* EXPORT_SYMBOL*
CALL_GRAPH = YES
EXTRACT_ALL = YES
@ -1168,7 +1173,8 @@ def doxygen_xml(a):
d = xml.dom.minidom.parse(x)
for m in d.getElementsByTagName("memberdef"):
n = m.getElementsByTagName("name")[0].firstChild.data
file = m.getElementsByTagName("location")[0].getAttribute('file')
file = (m.getElementsByTagName("location")[0]
.getAttribute('file'))
if file not in files:
print(file)
if n == 'main':