almighty
English | 中文
把字节数、大数字和比例格式化成一眼能读的量级。
安装
pip install almighty
用法
from almighty import human_count, human_ratio, human_size
human_size(0) # '0 B'
human_size(1536) # '1.5 KB'
human_size(1500, n_base=1000) # '1.5 KB'
human_count(1_200_000) # '1.2M'
human_ratio(1, 3) # '33.3%'
human_ratio(1, 0) # 'n/a'
说明
human_size 默认 1024 进制,传 n_base=1000 切十进制;human_ratio 分母为 0 时返回 n/a 而不抛错——报表需要一个可展示的值。
许可证
MIT
English
Human readable formatting for byte sizes, counts and ratios.
Install
pip install almighty
Usage
from almighty import human_count, human_ratio, human_size
human_size(0) # '0 B'
human_size(1536) # '1.5 KB'
human_size(1500, n_base=1000) # '1.5 KB'
human_count(1_200_000) # '1.2M'
human_ratio(1, 3) # '33.3%'
human_ratio(1, 0) # 'n/a'
Notes
Binary units by default; n_base=1000 switches to decimal. human_ratio returns n/a instead of raising on a zero total, because that is what a report needs to show.
License
MIT
Metadata
Release files for almighty 0.0.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| almighty-0.0.3.tar.gz | 3.0 kB | Without provenance | Details for almighty-0.0.3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| almighty-0.0.3-py3-none-any.whl | Python 3 | none | any | Details for almighty-0.0.3-py3-none-any.whl |
Total release size: 6.5 kB
Release files / almighty-0.0.3.tar.gz
| Download URL | almighty-0.0.3.tar.gz |
|---|---|
| Size | 3.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
abf96b2cafb7248efae0dd4458a102bb71ba6e9dde52783a49b53696481a6658
|
|
BLAKE2b-256 checksum How to use checksums |
cd6e218647399e19e0d2c2f91469f7ad64e1b785f8d5fe99078bfe5bd80dc42b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.10.11
|
Release files / almighty-0.0.3-py3-none-any.whl
| Download URL | almighty-0.0.3-py3-none-any.whl |
|---|---|
| Size | 3.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
fd03ef801f945b60e2d179920ee7e9caa70ebca42c86bfada231d0d9e0e41449
|
|
BLAKE2b-256 checksum How to use checksums |
e6d7447d445fbec227655ae2dd1c5ae1ba4526ace0c6b517a9512d3e23e71cca
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.10.11
|
Security for almighty 0.0.3
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.