tree aggregate on find
This commit is contained in:
@ -13,6 +13,10 @@ LAST_CHILD_CONNECTOR = '└── '
|
||||
LEVEL_INDENT = 4
|
||||
ITEMS_TO_EXCLUDE = ['__pycache__']
|
||||
|
||||
KB = 1024
|
||||
MB = 1024*1024
|
||||
GB = 1024*1024*1024
|
||||
|
||||
def mount_str_at(source_str, index, mount_str):
|
||||
l = len(mount_str)
|
||||
return source_str[:index] + mount_str + source_str[index+l:]
|
||||
@ -46,3 +50,20 @@ 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
|
||||
|
||||
return human_number, unit
|
||||
|
Reference in New Issue
Block a user