dhunter/util/util.py
def size_to_str(size_in_bytes: int, suffix: str = 'B') -> str:
        """Formats length in bytes into human readable string.
        """
        for unit in ['', 'Ki', 'Mi', 'Gi', 'Ti', 'Pi', 'Ei', 'Zi']:
            if abs(size_in_bytes) < 1024.0:
                if unit == '':
                    return '%d %s%s' % (size_in_bytes, unit, suffix)
                else:
                    return '%.1f %s%s' % (size_in_bytes, unit, suffix)
            size_in_bytes /= 1024.0
        return '%.1f %s%s' % (size_in_bytes, 'Yi', suffix)
Formats length in bytes into human readable string.
        
Formats length in bytes into human readable string.
Formats length in bytes into human readable string .
def size_to_str(size_in_bytes: int, suffix: str = 'B') -> str:
        for unit in ['', 'Ki', 'Mi', 'Gi', 'Ti', 'Pi', 'Ei', 'Zi']:
            if abs(size_in_bytes) < 1024.0:
                if unit == '':
                    return '%d %s%s' % (size_in_bytes, unit, suffix)
                else:
                    return '%.1f %s%s' % (size_in_bytes, unit, suffix)
            size_in_bytes /= 1024.0
        return '%.1f %s%s' % (size_in_bytes, 'Yi', suffix)
def size_to_str ( size_in_bytes : int , suffix : str = 'B' ) -> str : for unit in [ '' , 'Ki' , 'Mi' , 'Gi' , 'Ti' , 'Pi' , 'Ei' , 'Zi' ] : if abs ( size_in_bytes ) < 1024.0 : if unit == '' : return '%d %s%s' % ( size_in_bytes , unit , suffix ) else : return '%.1f %s%s' % ( size_in_bytes , unit , suffix ) size_in_bytes /= 1024.0 return '%.1f %s%s' % ( size_in_bytes , 'Yi' , suffix )
Formats length in bytes into human readable string.
Formats length in bytes into human readable string .
"""Formats length in bytes into human readable string.
        """
size_in_bytes
int
suffix
str