We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Code presently in amy.utils.files should be refactored to the Octue SDK utils, allowing us to present friendly file sizes for datasets and datafiles:
amy.utils.files
def size_kb(size_bytes): if not size_bytes: return 0 return size_bytes / 1024 def size_mb(size_bytes): if not size_bytes: return 0 return size_bytes / 1048576 def size_gb(size_bytes): if not size_bytes: return 0 return size_bytes / 1073741824 def size_tb(size_bytes): if not size_bytes: return 0 return size_bytes / 1099511627776 def size_str(size_bytes, fmt='%.02f '): """ Return sensible human formatted size string :param size_bytes: file/dataset size in bytes :param fmt: string format specifier for the floating point size. default '%.02f ' :return: str """ if size_bytes >= 1099511627776: return fmt % size_tb(size_bytes) + 'tb' if size_bytes >= 1073741824: return fmt % size_gb(size_bytes) + 'gb' if size_bytes >= 1048576: return fmt % size_mb(size_bytes) + 'mb' if size_bytes >= 1024: return fmt % size_kb(size_bytes) + 'kb' return fmt % size_bytes + 'b'
The text was updated successfully, but these errors were encountered:
thclark
No branches or pull requests
Code presently in
amy.utils.files
should be refactored to the Octue SDK utils, allowing us to present friendly file sizes for datasets and datafiles:The text was updated successfully, but these errors were encountered: