Metadata-Version: 2.5
Name: almighty
Version: 0.0.4
Summary: 把字节数、大数字和比例格式化成一眼能读的量级。
Project-URL: Homepage, https://pypi.org/project/almighty/
Author-email: lqxnjk <lqxnjk@qq.com>
License: MIT
License-File: LICENSE
Keywords: bytes,format,humanize,percent,size
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Typing :: Typed
Requires-Python: >=3.10
Description-Content-Type: text/markdown

# almighty

[English](#english) | 中文

把字节数、大数字和比例格式化成一眼能读的量级。

## 安装

```console
pip install almighty
```

## 用法

```python
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

---

<a id="english"></a>
## English

Human readable formatting for byte sizes, counts and ratios.

## Install

```console
pip install almighty
```

## Usage

```python
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
