MCPcopy Create free account
hub / github.com/RT-Thread/env-windows / show

Function show

tools/python-3.11.9-amd64/Tools/scripts/dutree.py:37–57  ·  view source on GitHub ↗
(total, d, prefix)

Source from the content-addressed store, hash-verified

35 show(total, d, '')
36
37def show(total, d, prefix):
38 if not d: return
39 list = []
40 sum = 0
41 for key in d.keys():
42 tsub, dsub = d[key]
43 list.append((tsub, key))
44 if tsub is not None: sum = sum + tsub
45## if sum < total:
46## list.append((total - sum, os.curdir))
47 list.sort()
48 list.reverse()
49 width = len(repr(list[0][0]))
50 for tsub, key in list:
51 if tsub is None:
52 psub = prefix
53 else:
54 print(prefix + repr(tsub).rjust(width) + ' ' + key)
55 psub = prefix + ' '*(width-1) + '|' + ' '*(len(key)+1)
56 if key in d:
57 show(tsub, d[key][1], psub)
58
59if __name__ == '__main__':
60 main()

Callers 1

displayFunction · 0.70

Calls 6

rjustMethod · 0.80
printFunction · 0.50
keysMethod · 0.45
appendMethod · 0.45
sortMethod · 0.45
reverseMethod · 0.45

Tested by

no test coverage detected