diff --git a/src/tree_repr.py b/src/tree_repr.py index f79be37..13eb7ad 100644 --- a/src/tree_repr.py +++ b/src/tree_repr.py @@ -11,7 +11,8 @@ CHILD_CONNECTOR = '├── ' LAST_CHILD_CONNECTOR = '└── ' ### is the length of child connector and last_child_connector LEVEL_INDENT = 4 -ITEMS_TO_EXCLUDE = ['__pycache__'] +# ITEMS_TO_EXCLUDE = ['__pycache__'] +ITEMS_TO_EXCLUDE = [] KB = 1024 MB = 1024*1024 @@ -51,19 +52,19 @@ def produce_treeline(prec_seps, lsep): return tree_line.rstrip() def format(num, unit=None): - # if num/GB >=1: - # unit = 'GB' - # human_number = round(num/GB, 2) - # elif num/MB >=1: - # unit = 'MB' - # human_number = round(num/MB, 2) - # elif num/KB >=1: - # unit = 'kB' - # human_number = round(num/KB, 2) - # else: - # unit = 'b' - # human_number = num - unit = 'b' - human_number = num + if num/GB >=1 or unit == 'G': + unit = 'G' + human_number = round(num/GB, 2) + elif num/MB >=1 or unit == 'M': + unit = 'M' + human_number = round(num/MB, 2) + elif num/KB >=1 or unit == 'K': + unit = 'K' + human_number = round(num/KB, 2) + else: + unit = 'B' + human_number = num + # unit = 'b' + # human_number = num return human_number, unit