from https://stackoverflow.com/questions/1094841/reusable-library-to-get-human-readable-version-of-file-size
(self, size)
| 1098 | return self.downloadSamples("MRUSProstate") |
| 1099 | |
| 1100 | def humanFormatSize(self, size): |
| 1101 | """from https://stackoverflow.com/questions/1094841/reusable-library-to-get-human-readable-version-of-file-size""" |
| 1102 | for x in ["bytes", "KB", "MB", "GB"]: |
| 1103 | if size < 1024.0 and size > -1024.0: |
| 1104 | return f"{size:3.1f} {x}" |
| 1105 | size /= 1024.0 |
| 1106 | return "{:3.1f} {}".format(size, "TB") |
| 1107 | |
| 1108 | def reportHook(self, blocksSoFar, blockSize, totalSize): |
| 1109 | # we clamp to 100% because the blockSize might be larger than the file itself |