pymensago/utils.py
def size_as_string(size: int) -> str:
	'''Converts the integer to a string in SI units'''
	
	if size < 0:
		size = 0
	
	size_list = [
		(1_000_000_000_000_000, 'PB'),
		(1_000_000_000_000, 'TB'),
		(1_000_000_000, 'GB'),
		(1_000_000, 'MB'),
		(1_000, 'KB'),
	]

	for size_pair in size_list:
		if size >= size_pair[0]:
			return str(round(size / size_pair[0], 2)) + size_pair[1]
	
	return str(size) + ' bytes'
Converts the integer to a string in SI units
Converts the integer to a string in SI units
Converts the integer to a string in SI units
def size_as_string(size: int) -> str:
	if size < 0:
		size = 0
	size_list = [
		(1_000_000_000_000_000, 'PB'),
		(1_000_000_000_000, 'TB'),
		(1_000_000_000, 'GB'),
		(1_000_000, 'MB'),
		(1_000, 'KB'),
	]
	for size_pair in size_list:
		if size >= size_pair[0]:
			return str(round(size / size_pair[0], 2)) + size_pair[1]
	return str(size) + ' bytes'
def size_as_string ( size : int ) -> str : if size < 0 : size = 0 size_list = [ ( 1_000_000_000_000_000 , 'PB' ) , ( 1_000_000_000_000 , 'TB' ) , ( 1_000_000_000 , 'GB' ) , ( 1_000_000 , 'MB' ) , ( 1_000 , 'KB' ) , ] for size_pair in size_list : if size >= size_pair [ 0 ] : return str ( round ( size / size_pair [ 0 ] , 2 ) ) + size_pair [ 1 ] return str ( size ) + ' bytes'
Converts the integer to a string in SI units
Converts the integer to a string in SI units
'''Converts the integer to a string in SI units'''
size
int