Metadata-Version: 2.5
Name: lqxnjk
Version: 0.0.3
Summary: 把时间区间按固定步长切成窗口。
Project-URL: Homepage, https://pypi.org/project/lqxnjk/
Author-email: lqxnjk <lqxnjk@qq.com>
License: MIT
License-File: LICENSE
Keywords: datetime,interval,range,split,window
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

# lqxnjk

[English](#english) | 中文

把时间区间按固定步长切成窗口。

## 安装

```console
pip install lqxnjk
```

## 用法

```python
from datetime import datetime

from lqxnjk import split_windows

start = datetime(2026, 1, 1)
end = datetime(2026, 1, 4)

split_windows(start, end)
# [(2026-01-01 00:00, 2026-01-02 00:00), (..., 01-03), (..., 01-04)]

split_windows(start, end, n_hours=12)   # 6 个窗口
```

## 说明

接受 `date` 或 `datetime`，纯日期按当天零点处理。左闭右开：相邻窗口不重叠，末尾不足一个步长的那段保留。起点不早于终点、或步长为 0 时抛 `ValueError`。

## 许可证

MIT

---

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

Split a time range into fixed windows.

## Install

```console
pip install lqxnjk
```

## Usage

```python
from datetime import datetime

from lqxnjk import split_windows

start = datetime(2026, 1, 1)
end = datetime(2026, 1, 4)

split_windows(start, end)
# [(2026-01-01 00:00, 2026-01-02 00:00), (..., 01-03), (..., 01-04)]

split_windows(start, end, n_hours=12)   # 6 个窗口
```

## Notes

Accepts `date` or `datetime`; a bare date means midnight. Windows are half-open, so they never overlap, and a trailing partial window is kept. A start not before the end, or a zero step, raises `ValueError`.

## License

MIT
