borax


Nameborax JSON
Version 4.1.1 PyPI version JSON
download
home_pageNone
SummaryA tool collections.(Chinese-Lunar-Calendars/Python-Patterns)
upload_time2024-06-30 07:25:33
maintainerNone
docs_urlNone
authorkinegratii
requires_python>=3.9
licenseMIT License
keywords chinese lunar calendar python tool
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Borax - python农历&节日工具库 - 中文数字/设计模式/树形结构


[![PyPI](https://img.shields.io/pypi/v/borax.svg)](https://pypi.org/project/borax) 
[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/borax.svg)](https://pypi.org/project/borax)
![Python package](https://github.com/kinegratii/borax/workflows/Python%20package/badge.svg)
![Codecov](https://codecov.io/github/kinegratii/borax/coverage.svg)
![GitHub license](https://img.shields.io/github/license/kinegratii/borax)
[![borax](https://snyk.io/advisor/python/borax/badge.svg)](https://snyk.io/advisor/python/borax)


## 概述 (Overview)

> github  https://github.com/kinegratii/borax
>
> gitee  https://gitee.com/kinegratii/borax



Borax 是一个Python3工具集合库。包括了以下几个话题:

| 话题(Topics)      | 内容                                                  |
| ------------------- | ----------------------------------------------------- |
| Borax.LunarDate     | 1900-2100年的中国农历日期库                           |
| Borax.Festivals     | 实现常见节日(公历、农历、星期、节气)的工具库                           |
| Borax.Choices       | 声明式的选项类。适用于Django.models.choices 定义。    |
| Borax.Datasets      | 记录型数据操作库,包括连结(Join)、列选择(fetch)等 |
| Borax.DataStuctures | 树形结构,json数据                                    |
| Borax.Numbers       | 数字库。包括中文数字、百分数等。                      |
| Borax.Patterns      | 设计模式。包括单例模式、代理对象、延迟对象。          |

## 安装 (Installation)

Borax 的 python 版本要求如下

| borax 版本 | python版本 | 维护状态 |
| ------ | ------ | ------ |
| 4.1.x | 3.9+ | 维护开发 |
| 4.0.0 | 3.7+ | 维护至2024年12月31日 |
| 3.x | 3.5+ | 不再维护 |

可以通过 *pip* 安装 :

```shell
$ pip install borax
```

## 版本 (Version)

Borax的版本符合 [语义化版本](https://semver.org/lang/zh-CN/) ,格式为 `<主版本号>.<副版本号>.<修正版本号>`, 推荐使用下面方式定义Borax的依赖版本号。

```text
borax~=4.1
```

## 使用示例 (Usage)

### Borax.LunarDate: 中国农历日期

一个支持1900-2100年的农历日期工具库。

> 本模块的数据和算法参考自项目 [jjonline/calendar.js](https://github.com/jjonline/calendar.js)  ,部分算法和数据有所修改。

创建日期,日期推算

```python
from datetime import timedelta
from borax.calendars import LunarDate

# 获取今天的农历日期(农历二〇一八年七月初一)
print(LunarDate.today()) # LunarDate(2018, 7, 1, 0)

# 将公历日期转化为农历日期
ld = LunarDate.from_solar_date(2018, 8, 11)
print(ld) # LunarDate(2018, 7, 1, 0)

# 日期推算,返回10天后的农历日期
print(ld.after(10)) # LunarDate(2018, 7, 11, 0)

# 可以直接与 datetime.timedelta 直接相加减
print(ld + timedelta(days=10)) # LunarDate(2018, 7, 11, 0)
```

格式化字符串

```python
today = LunarDate.today()
print(today.strftime('%Y年%L%M月%D')) # '二〇一八年六月廿六'
print(today.strftime('今天的干支表示法为:%G')) # '今天的干支表示法为:戊戌年庚申月辛未日'
```

### Borax.Festival: 国内外节日

创建春节(每年正月初一)对应的节日对象

```python
from borax.calendars.festivals2 import LunarFestival

festival = LunarFestival(month=1, day=1)
print(festival.description) # '农历每年正月初一'

# 下一次春节的具体日期以及距离天数
print(festival.countdown()) # (273, <WrappedDate:2022-02-01(二〇二二年正月初一)>)

# 接下来5个春节的日期 ['2022-02-01(二〇二二年正月初一)', '2023-01-22(二〇二三年正月初一)', '2024-02-10(二〇二四年正月初一)', '2025-01-29(二〇二五年正月初一)', '2026-02-17(二〇二六年正月初一)']
print([str(wd) for wd in festival.list_days(start_date=date.today(), count=5)])
```

### 可支持的节日类型

| 节日                          | 表示法                                                | 规范化描述                |
| ----------------------------- | ----------------------------------------------------- | ------------------------- |
| 元旦                          | SolarFestival(month=1, day=1)                         | 农历每年正月初一          |
| 中秋节                        | LunarFestival(month=8, day=15)                        | 农历每年八月十五          |
| 母亲节(每年5月第二个周日)   | WeekFestival(month=5, index=2, week=calendar.SUNDAY)  | 公历每年5月第2个星期日    |
| 除夕             | LunarFestival(day=-1)                                 | 农历每年最后一天          |
| 程序员节                      | SolarFestival(freq=FreqConst.YEARLY,day=256)         | 公历每年第256天           |
| 清明节                        | TemFestival(name="清明")                              | 公历每年清明              |
| 每月5日                       | SolarFestival(freq=FreqConst.MONTHLY, day=5)         | 公历每月5日               |
| 国际麻风节       | WeekFestival(month=1, index=-1, week=calendar.SUNDAY) | 公历1月倒数第1个星期日    |
| 每月最后一个周日 | WeekFestival(month=0, index=-1, week=calendar.SUNDAY) | 公历每月倒数第1个星期日   |
| 初伏 | TemFestival('夏至', nth=3, day_gz='庚') | 公历每年夏至起第三个庚日   |

### Borax.FestivalLibrary:内置节日库

基本使用示例

```python
from datetime import date
from borax.calendars.festivals2 import FestivalLibrary, WrappedDate

library = FestivalLibrary.load_builtin()

# 2020年国庆节和中秋节是同一天
names = library.get_festival_names(date(2020, 10, 1))
print(names) # ['国庆节', '中秋节']

# 2021年七夕
festival = library.get_festival('七夕')
print(festival.description) # '农历每年七月初七'
print(WrappedDate(festival.at(year=2021))) # '2021-08-14(二〇二一年七月初七)'
```

计算节日及其距离今天(2021年5月4日)的天数

```python

from borax.calendars.festivals2 import FestivalLibrary

library = FestivalLibrary.load_builtin()
for ndays, wd, festival in library.list_days_in_countdown(countdown=365):
    print(f'{ndays:>3d} {wd} {festival.name}')
```

输出结果

```
  0 2022-05-04(四月初四) 青年节
  4 2022-05-08(四月初八) 母亲节
  8 2022-05-12(四月十二) 护士节
...
332 2023-04-01(闰二月十一) 愚人节
336 2023-04-05(闰二月十五) 清明
362 2023-05-01(三月十二) 劳动节

```


### Borax.Numbers: 中文数字处理


不同形式的中文数字

```python
from borax.numbers import ChineseNumbers

# 小写、计量
print(ChineseNumbers.measure_number(204)) # '二百零四'
# 小写、编号
print(ChineseNumbers.order_number(204)) # '二百〇四'
# 大写、计量
print(ChineseNumbers.measure_number(204, upper=True)) # '贰佰零肆'
# 大写、编号
print(ChineseNumbers.order_number(204, upper=True)) # '贰佰〇肆'
```

财务金额

```python
import decimal

from borax.numbers import FinanceNumbers

decimal.getcontext().prec = 2

print(FinanceNumbers.to_capital_str(100000000)) # '壹亿元整'
print(FinanceNumbers.to_capital_str(4578442.23)) # '肆佰伍拾柒万捌仟肆佰肆拾贰元贰角叁分'
print(FinanceNumbers.to_capital_str(107000.53)) # '壹拾万柒仟元伍角叁分'
print(FinanceNumbers.to_capital_str(decimal.Decimal(4.50))) # '肆元伍角零分'
```

更多模块功能参见文档。

## 文档 (Document)

文档由 [Material for MkDocs](https://squidfunk.github.io/mkdocs-material/) 构建 ~~,另外备用文档使用 [docsify](https://docsify.js.org/) 构建~~ 。

> 2024年1月起,仅保留 Read the Docs 文档源。

| 源 | 网址 |
| ---- | ---- |
| read-the-docs | [https://borax.readthedocs.io/zh_CN/latest/](https://borax.readthedocs.io/zh_CN/latest/) |
| github(已废弃) | [https://kinegratii.github.io/borax](https://kinegratii.github.io/borax) |
| gitee(已废弃) | [https://kinegratii.gitee.io/borax](https://kinegratii.gitee.io/borax) |

## 开发特性和规范 (Development Features)

- [x] [Typing Hints](https://www.python.org/dev/peps/pep-0484/)
- [x] [Flake8 Code Style](http://flake8.pycqa.org/en/latest/)
- [x] [nose2](https://pypi.org/project/nose2/) | [pytest](https://docs.pytest.org/en/latest/)
- [x] [Github Action](https://github.com/kinegratii/borax/actions)
- [x] [Code Coverage](https://codecov.io/)
- [x] [pyproject.toml build tools](https://packaging.python.org/)

## 项目构建 (Project Build)

从4.1.0 开始,borax 使用 *pyproject.toml* 作为项目构建的配置文件,使用以下命令构建 wheel 发行包。

```shell
python -m build -w
```

## 开源协议 (License)

The MIT License (MIT)


            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "borax",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.9",
    "maintainer_email": null,
    "keywords": "chinese lunar calendar, python tool",
    "author": "kinegratii",
    "author_email": "kinegratii <zhenwei.yan@hotmail.com>",
    "download_url": null,
    "platform": null,
    "description": "# Borax - python\u519c\u5386&\u8282\u65e5\u5de5\u5177\u5e93 - \u4e2d\u6587\u6570\u5b57/\u8bbe\u8ba1\u6a21\u5f0f/\u6811\u5f62\u7ed3\u6784\r\n\r\n\r\n[![PyPI](https://img.shields.io/pypi/v/borax.svg)](https://pypi.org/project/borax) \r\n[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/borax.svg)](https://pypi.org/project/borax)\r\n![Python package](https://github.com/kinegratii/borax/workflows/Python%20package/badge.svg)\r\n![Codecov](https://codecov.io/github/kinegratii/borax/coverage.svg)\r\n![GitHub license](https://img.shields.io/github/license/kinegratii/borax)\r\n[![borax](https://snyk.io/advisor/python/borax/badge.svg)](https://snyk.io/advisor/python/borax)\r\n\r\n\r\n## \u6982\u8ff0 (Overview)\r\n\r\n> github  https://github.com/kinegratii/borax\r\n>\r\n> gitee  https://gitee.com/kinegratii/borax\r\n\r\n\r\n\r\nBorax \u662f\u4e00\u4e2aPython3\u5de5\u5177\u96c6\u5408\u5e93\u3002\u5305\u62ec\u4e86\u4ee5\u4e0b\u51e0\u4e2a\u8bdd\u9898\uff1a\r\n\r\n| \u8bdd\u9898\uff08Topics\uff09      | \u5185\u5bb9                                                  |\r\n| ------------------- | ----------------------------------------------------- |\r\n| Borax.LunarDate     | 1900-2100\u5e74\u7684\u4e2d\u56fd\u519c\u5386\u65e5\u671f\u5e93                           |\r\n| Borax.Festivals     | \u5b9e\u73b0\u5e38\u89c1\u8282\u65e5\uff08\u516c\u5386\u3001\u519c\u5386\u3001\u661f\u671f\u3001\u8282\u6c14\uff09\u7684\u5de5\u5177\u5e93                           |\r\n| Borax.Choices       | \u58f0\u660e\u5f0f\u7684\u9009\u9879\u7c7b\u3002\u9002\u7528\u4e8eDjango.models.choices \u5b9a\u4e49\u3002    |\r\n| Borax.Datasets      | \u8bb0\u5f55\u578b\u6570\u636e\u64cd\u4f5c\u5e93\uff0c\u5305\u62ec\u8fde\u7ed3\uff08Join\uff09\u3001\u5217\u9009\u62e9\uff08fetch\uff09\u7b49 |\r\n| Borax.DataStuctures | \u6811\u5f62\u7ed3\u6784\uff0cjson\u6570\u636e                                    |\r\n| Borax.Numbers       | \u6570\u5b57\u5e93\u3002\u5305\u62ec\u4e2d\u6587\u6570\u5b57\u3001\u767e\u5206\u6570\u7b49\u3002                      |\r\n| Borax.Patterns      | \u8bbe\u8ba1\u6a21\u5f0f\u3002\u5305\u62ec\u5355\u4f8b\u6a21\u5f0f\u3001\u4ee3\u7406\u5bf9\u8c61\u3001\u5ef6\u8fdf\u5bf9\u8c61\u3002          |\r\n\r\n## \u5b89\u88c5 (Installation)\r\n\r\nBorax \u7684 python \u7248\u672c\u8981\u6c42\u5982\u4e0b\r\n\r\n| borax \u7248\u672c | python\u7248\u672c | \u7ef4\u62a4\u72b6\u6001 |\r\n| ------ | ------ | ------ |\r\n| 4.1.x | 3.9+ | \u7ef4\u62a4\u5f00\u53d1 |\r\n| 4.0.0 | 3.7+ | \u7ef4\u62a4\u81f32024\u5e7412\u670831\u65e5 |\r\n| 3.x | 3.5+ | \u4e0d\u518d\u7ef4\u62a4 |\r\n\r\n\u53ef\u4ee5\u901a\u8fc7 *pip* \u5b89\u88c5 \uff1a\r\n\r\n```shell\r\n$ pip install borax\r\n```\r\n\r\n## \u7248\u672c (Version)\r\n\r\nBorax\u7684\u7248\u672c\u7b26\u5408 [\u8bed\u4e49\u5316\u7248\u672c](https://semver.org/lang/zh-CN/) \uff0c\u683c\u5f0f\u4e3a `<\u4e3b\u7248\u672c\u53f7>.<\u526f\u7248\u672c\u53f7>.<\u4fee\u6b63\u7248\u672c\u53f7>`\uff0c \u63a8\u8350\u4f7f\u7528\u4e0b\u9762\u65b9\u5f0f\u5b9a\u4e49Borax\u7684\u4f9d\u8d56\u7248\u672c\u53f7\u3002\r\n\r\n```text\r\nborax~=4.1\r\n```\r\n\r\n## \u4f7f\u7528\u793a\u4f8b (Usage)\r\n\r\n### Borax.LunarDate: \u4e2d\u56fd\u519c\u5386\u65e5\u671f\r\n\r\n\u4e00\u4e2a\u652f\u63011900-2100\u5e74\u7684\u519c\u5386\u65e5\u671f\u5de5\u5177\u5e93\u3002\r\n\r\n> \u672c\u6a21\u5757\u7684\u6570\u636e\u548c\u7b97\u6cd5\u53c2\u8003\u81ea\u9879\u76ee [jjonline/calendar.js](https://github.com/jjonline/calendar.js)  \uff0c\u90e8\u5206\u7b97\u6cd5\u548c\u6570\u636e\u6709\u6240\u4fee\u6539\u3002\r\n\r\n\u521b\u5efa\u65e5\u671f\uff0c\u65e5\u671f\u63a8\u7b97\r\n\r\n```python\r\nfrom datetime import timedelta\r\nfrom borax.calendars import LunarDate\r\n\r\n# \u83b7\u53d6\u4eca\u5929\u7684\u519c\u5386\u65e5\u671f\uff08\u519c\u5386\u4e8c\u3007\u4e00\u516b\u5e74\u4e03\u6708\u521d\u4e00\uff09\r\nprint(LunarDate.today()) # LunarDate(2018, 7, 1, 0)\r\n\r\n# \u5c06\u516c\u5386\u65e5\u671f\u8f6c\u5316\u4e3a\u519c\u5386\u65e5\u671f\r\nld = LunarDate.from_solar_date(2018, 8, 11)\r\nprint(ld) # LunarDate(2018, 7, 1, 0)\r\n\r\n# \u65e5\u671f\u63a8\u7b97\uff0c\u8fd4\u56de10\u5929\u540e\u7684\u519c\u5386\u65e5\u671f\r\nprint(ld.after(10)) # LunarDate(2018, 7, 11, 0)\r\n\r\n# \u53ef\u4ee5\u76f4\u63a5\u4e0e datetime.timedelta \u76f4\u63a5\u76f8\u52a0\u51cf\r\nprint(ld + timedelta(days=10)) # LunarDate(2018, 7, 11, 0)\r\n```\r\n\r\n\u683c\u5f0f\u5316\u5b57\u7b26\u4e32\r\n\r\n```python\r\ntoday = LunarDate.today()\r\nprint(today.strftime('%Y\u5e74%L%M\u6708%D')) # '\u4e8c\u3007\u4e00\u516b\u5e74\u516d\u6708\u5eff\u516d'\r\nprint(today.strftime('\u4eca\u5929\u7684\u5e72\u652f\u8868\u793a\u6cd5\u4e3a\uff1a%G')) # '\u4eca\u5929\u7684\u5e72\u652f\u8868\u793a\u6cd5\u4e3a\uff1a\u620a\u620c\u5e74\u5e9a\u7533\u6708\u8f9b\u672a\u65e5'\r\n```\r\n\r\n### Borax.Festival: \u56fd\u5185\u5916\u8282\u65e5\r\n\r\n\u521b\u5efa\u6625\u8282\uff08\u6bcf\u5e74\u6b63\u6708\u521d\u4e00\uff09\u5bf9\u5e94\u7684\u8282\u65e5\u5bf9\u8c61\r\n\r\n```python\r\nfrom borax.calendars.festivals2 import LunarFestival\r\n\r\nfestival = LunarFestival(month=1, day=1)\r\nprint(festival.description) # '\u519c\u5386\u6bcf\u5e74\u6b63\u6708\u521d\u4e00'\r\n\r\n# \u4e0b\u4e00\u6b21\u6625\u8282\u7684\u5177\u4f53\u65e5\u671f\u4ee5\u53ca\u8ddd\u79bb\u5929\u6570\r\nprint(festival.countdown()) # (273, <WrappedDate:2022-02-01(\u4e8c\u3007\u4e8c\u4e8c\u5e74\u6b63\u6708\u521d\u4e00)>)\r\n\r\n# \u63a5\u4e0b\u67655\u4e2a\u6625\u8282\u7684\u65e5\u671f ['2022-02-01(\u4e8c\u3007\u4e8c\u4e8c\u5e74\u6b63\u6708\u521d\u4e00)', '2023-01-22(\u4e8c\u3007\u4e8c\u4e09\u5e74\u6b63\u6708\u521d\u4e00)', '2024-02-10(\u4e8c\u3007\u4e8c\u56db\u5e74\u6b63\u6708\u521d\u4e00)', '2025-01-29(\u4e8c\u3007\u4e8c\u4e94\u5e74\u6b63\u6708\u521d\u4e00)', '2026-02-17(\u4e8c\u3007\u4e8c\u516d\u5e74\u6b63\u6708\u521d\u4e00)']\r\nprint([str(wd) for wd in festival.list_days(start_date=date.today(), count=5)])\r\n```\r\n\r\n### \u53ef\u652f\u6301\u7684\u8282\u65e5\u7c7b\u578b\r\n\r\n| \u8282\u65e5                          | \u8868\u793a\u6cd5                                                | \u89c4\u8303\u5316\u63cf\u8ff0                |\r\n| ----------------------------- | ----------------------------------------------------- | ------------------------- |\r\n| \u5143\u65e6                          | SolarFestival(month=1, day=1)                         | \u519c\u5386\u6bcf\u5e74\u6b63\u6708\u521d\u4e00          |\r\n| \u4e2d\u79cb\u8282                        | LunarFestival(month=8, day=15)                        | \u519c\u5386\u6bcf\u5e74\u516b\u6708\u5341\u4e94          |\r\n| \u6bcd\u4eb2\u8282\uff08\u6bcf\u5e745\u6708\u7b2c\u4e8c\u4e2a\u5468\u65e5\uff09   | WeekFestival(month=5, index=2, week=calendar.SUNDAY)  | \u516c\u5386\u6bcf\u5e745\u6708\u7b2c2\u4e2a\u661f\u671f\u65e5    |\r\n| \u9664\u5915             | LunarFestival(day=-1)                                 | \u519c\u5386\u6bcf\u5e74\u6700\u540e\u4e00\u5929          |\r\n| \u7a0b\u5e8f\u5458\u8282                      | SolarFestival(freq=FreqConst.YEARLY\uff0cday=256)         | \u516c\u5386\u6bcf\u5e74\u7b2c256\u5929           |\r\n| \u6e05\u660e\u8282                        | TemFestival(name=\"\u6e05\u660e\")                              | \u516c\u5386\u6bcf\u5e74\u6e05\u660e              |\r\n| \u6bcf\u67085\u65e5                       | SolarFestival(freq=FreqConst.MONTHLY\uff0c day=5)         | \u516c\u5386\u6bcf\u67085\u65e5               |\r\n| \u56fd\u9645\u9ebb\u98ce\u8282       | WeekFestival(month=1, index=-1, week=calendar.SUNDAY) | \u516c\u53861\u6708\u5012\u6570\u7b2c1\u4e2a\u661f\u671f\u65e5    |\r\n| \u6bcf\u6708\u6700\u540e\u4e00\u4e2a\u5468\u65e5 | WeekFestival(month=0, index=-1, week=calendar.SUNDAY) | \u516c\u5386\u6bcf\u6708\u5012\u6570\u7b2c1\u4e2a\u661f\u671f\u65e5   |\r\n| \u521d\u4f0f | TemFestival('\u590f\u81f3', nth=3, day_gz='\u5e9a') | \u516c\u5386\u6bcf\u5e74\u590f\u81f3\u8d77\u7b2c\u4e09\u4e2a\u5e9a\u65e5   |\r\n\r\n### Borax.FestivalLibrary\uff1a\u5185\u7f6e\u8282\u65e5\u5e93\r\n\r\n\u57fa\u672c\u4f7f\u7528\u793a\u4f8b\r\n\r\n```python\r\nfrom datetime import date\r\nfrom borax.calendars.festivals2 import FestivalLibrary, WrappedDate\r\n\r\nlibrary = FestivalLibrary.load_builtin()\r\n\r\n# 2020\u5e74\u56fd\u5e86\u8282\u548c\u4e2d\u79cb\u8282\u662f\u540c\u4e00\u5929\r\nnames = library.get_festival_names(date(2020, 10, 1))\r\nprint(names) # ['\u56fd\u5e86\u8282', '\u4e2d\u79cb\u8282']\r\n\r\n# 2021\u5e74\u4e03\u5915\r\nfestival = library.get_festival('\u4e03\u5915')\r\nprint(festival.description) # '\u519c\u5386\u6bcf\u5e74\u4e03\u6708\u521d\u4e03'\r\nprint(WrappedDate(festival.at(year=2021))) # '2021-08-14(\u4e8c\u3007\u4e8c\u4e00\u5e74\u4e03\u6708\u521d\u4e03)'\r\n```\r\n\r\n\u8ba1\u7b97\u8282\u65e5\u53ca\u5176\u8ddd\u79bb\u4eca\u5929\uff082021\u5e745\u67084\u65e5\uff09\u7684\u5929\u6570\r\n\r\n```python\r\n\r\nfrom borax.calendars.festivals2 import FestivalLibrary\r\n\r\nlibrary = FestivalLibrary.load_builtin()\r\nfor ndays, wd, festival in library.list_days_in_countdown(countdown=365):\r\n    print(f'{ndays:>3d} {wd} {festival.name}')\r\n```\r\n\r\n\u8f93\u51fa\u7ed3\u679c\r\n\r\n```\r\n  0 2022-05-04(\u56db\u6708\u521d\u56db) \u9752\u5e74\u8282\r\n  4 2022-05-08(\u56db\u6708\u521d\u516b) \u6bcd\u4eb2\u8282\r\n  8 2022-05-12(\u56db\u6708\u5341\u4e8c) \u62a4\u58eb\u8282\r\n...\r\n332 2023-04-01(\u95f0\u4e8c\u6708\u5341\u4e00) \u611a\u4eba\u8282\r\n336 2023-04-05(\u95f0\u4e8c\u6708\u5341\u4e94) \u6e05\u660e\r\n362 2023-05-01(\u4e09\u6708\u5341\u4e8c) \u52b3\u52a8\u8282\r\n\r\n```\r\n\r\n\r\n### Borax.Numbers: \u4e2d\u6587\u6570\u5b57\u5904\u7406\r\n\r\n\r\n\u4e0d\u540c\u5f62\u5f0f\u7684\u4e2d\u6587\u6570\u5b57\r\n\r\n```python\r\nfrom borax.numbers import ChineseNumbers\r\n\r\n# \u5c0f\u5199\u3001\u8ba1\u91cf\r\nprint(ChineseNumbers.measure_number(204)) # '\u4e8c\u767e\u96f6\u56db'\r\n# \u5c0f\u5199\u3001\u7f16\u53f7\r\nprint(ChineseNumbers.order_number(204)) # '\u4e8c\u767e\u3007\u56db'\r\n# \u5927\u5199\u3001\u8ba1\u91cf\r\nprint(ChineseNumbers.measure_number(204, upper=True)) # '\u8d30\u4f70\u96f6\u8086'\r\n# \u5927\u5199\u3001\u7f16\u53f7\r\nprint(ChineseNumbers.order_number(204, upper=True)) # '\u8d30\u4f70\u3007\u8086'\r\n```\r\n\r\n\u8d22\u52a1\u91d1\u989d\r\n\r\n```python\r\nimport decimal\r\n\r\nfrom borax.numbers import FinanceNumbers\r\n\r\ndecimal.getcontext().prec = 2\r\n\r\nprint(FinanceNumbers.to_capital_str(100000000)) # '\u58f9\u4ebf\u5143\u6574'\r\nprint(FinanceNumbers.to_capital_str(4578442.23)) # '\u8086\u4f70\u4f0d\u62fe\u67d2\u4e07\u634c\u4edf\u8086\u4f70\u8086\u62fe\u8d30\u5143\u8d30\u89d2\u53c1\u5206'\r\nprint(FinanceNumbers.to_capital_str(107000.53)) # '\u58f9\u62fe\u4e07\u67d2\u4edf\u5143\u4f0d\u89d2\u53c1\u5206'\r\nprint(FinanceNumbers.to_capital_str(decimal.Decimal(4.50))) # '\u8086\u5143\u4f0d\u89d2\u96f6\u5206'\r\n```\r\n\r\n\u66f4\u591a\u6a21\u5757\u529f\u80fd\u53c2\u89c1\u6587\u6863\u3002\r\n\r\n## \u6587\u6863 (Document)\r\n\r\n\u6587\u6863\u7531 [Material for MkDocs](https://squidfunk.github.io/mkdocs-material/) \u6784\u5efa ~~\uff0c\u53e6\u5916\u5907\u7528\u6587\u6863\u4f7f\u7528 [docsify](https://docsify.js.org/) \u6784\u5efa~~ \u3002\r\n\r\n> 2024\u5e741\u6708\u8d77\uff0c\u4ec5\u4fdd\u7559 Read the Docs \u6587\u6863\u6e90\u3002\r\n\r\n| \u6e90 | \u7f51\u5740 |\r\n| ---- | ---- |\r\n| read-the-docs | [https://borax.readthedocs.io/zh_CN/latest/](https://borax.readthedocs.io/zh_CN/latest/) |\r\n| github\uff08\u5df2\u5e9f\u5f03\uff09 | [https://kinegratii.github.io/borax](https://kinegratii.github.io/borax) |\r\n| gitee\uff08\u5df2\u5e9f\u5f03\uff09 | [https://kinegratii.gitee.io/borax](https://kinegratii.gitee.io/borax) |\r\n\r\n## \u5f00\u53d1\u7279\u6027\u548c\u89c4\u8303 (Development Features)\r\n\r\n- [x] [Typing Hints](https://www.python.org/dev/peps/pep-0484/)\r\n- [x] [Flake8 Code Style](http://flake8.pycqa.org/en/latest/)\r\n- [x] [nose2](https://pypi.org/project/nose2/) | [pytest](https://docs.pytest.org/en/latest/)\r\n- [x] [Github Action](https://github.com/kinegratii/borax/actions)\r\n- [x] [Code Coverage](https://codecov.io/)\r\n- [x] [pyproject.toml build tools](https://packaging.python.org/)\r\n\r\n## \u9879\u76ee\u6784\u5efa (Project Build)\r\n\r\n\u4ece4.1.0 \u5f00\u59cb\uff0cborax \u4f7f\u7528 *pyproject.toml* \u4f5c\u4e3a\u9879\u76ee\u6784\u5efa\u7684\u914d\u7f6e\u6587\u4ef6\uff0c\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u6784\u5efa wheel \u53d1\u884c\u5305\u3002\r\n\r\n```shell\r\npython -m build -w\r\n```\r\n\r\n## \u5f00\u6e90\u534f\u8bae (License)\r\n\r\nThe MIT License (MIT)\r\n\r\n",
    "bugtrack_url": null,
    "license": "MIT License",
    "summary": "A tool collections.(Chinese-Lunar-Calendars/Python-Patterns)",
    "version": "4.1.1",
    "project_urls": {
        "Documentation": "https://borax.readthedocs.io/zh_CN/latest/",
        "Homepage": "https://github.com/kinegratii/borax",
        "Repository": "https://github.com/kinegratii/borax"
    },
    "split_keywords": [
        "chinese lunar calendar",
        " python tool"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "6b3219840380dadd756e7b858946d6d6bea8fd7f67de109e368696624ceabd26",
                "md5": "f00fadea347194b80e41e7250a21e6e9",
                "sha256": "69a9566039b1b5d7f9a8839264e8964dd4b0ee8797ed8887d502043b20441d10"
            },
            "downloads": -1,
            "filename": "borax-4.1.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "f00fadea347194b80e41e7250a21e6e9",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9",
            "size": 64249,
            "upload_time": "2024-06-30T07:25:33",
            "upload_time_iso_8601": "2024-06-30T07:25:33.269318Z",
            "url": "https://files.pythonhosted.org/packages/6b/32/19840380dadd756e7b858946d6d6bea8fd7f67de109e368696624ceabd26/borax-4.1.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-06-30 07:25:33",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "kinegratii",
    "github_project": "borax",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "borax"
}
        
Elapsed time: 0.54769s