:rocket: lautpy — 常用工具类 :facepunch:
轻量的 Python 工具集:管道式数据处理 + 日期/路径/哈希等常用工具函数。核心零强制依赖,第三方库(numpy/pandas/scikit-learn 等)按需可选。
Install
pip install -U lautpy
Pipe 管道工具
from lautpy.pipe import *
# Unix 风格管道:data | func1 | func2
[1, 2, 3, 4] | xmap_(lambda x: x * 2) | xfilter_(lambda x: x > 3) # [4, 6, 8]
# 进度条 + 日志 + 计时
for i in range(5) | xtqdm:
logger.info("这是一个进度条")
with timer('LOG'):
logger.info("打印一条log所花费的时间")
常用管道(约定:尾部下划线 = 立即求值返回 list):
| 类别 | 管道 |
|---|---|
| 类型转换 | xtuple xlist xset xarray |
| 高阶函数 | xmap xmap_ xfilter xfilter_ xenumerate xchain xchain_ xreduce xdrop xdrop_ |
| 字典 | xchain_dict xDictValues xDictRemove xgetitem xitemgetter |
| 分组/去重 | xgroup xUnique xsort xCounter xCounterUpdate |
| 并发 | xJobs xThreadPoolExecutor xProcessPoolExecutor xAsyncio |
| 字符串 | xjoin xstartswith xendswith xsse_parser |
其他模块
from lautpy import dates, hashing, paths
# 日期(纯标准库)
dates.date_difference(days=1) # 昨天
dates.timestamp2str(time.time()) # 时间戳 -> 字符串
dates.get_nday_list(7) # 过去 7 天
# 哈希 / AB 实验(murmurhash 需 scikit-learn)
hashing.md5("key:value")
hashing.murmurhash(bins=100) # 与 Java Guava 口径一致
hashing.ABTest(expid='10001', ranger=(0, 99)).is_hit("userid")
# 路径 / 配置(yaml 支持需 pyyaml)
paths.file2json("config.yaml") # json/yaml -> dict
paths.path2list("dir", "*.txt") # 文件/目录展开
设计约定
import lautpy零第三方强制依赖,无导入副作用- 第三方依赖的管道函数在库缺失时自动不可用,不影响其余功能
from lautpy.pipe import *仅导出公共 API(__all__),不泄漏实现细节
License
Apache-2.0。部分代码移植自 MeUtils(MIT License, Copyright (c) yuanjie),详见各模块 docstring。
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file lautpy-0.0.3.0.tar.gz.
File metadata
- Download URL: lautpy-0.0.3.0.tar.gz
- Upload date:
- Size: 16.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
66376c1b98a83181ae8493dceea55e1dc8b9064dacd06cbc23c01af3d8220f4c
|
|
| MD5 |
2991d034b0b115737b8456b245d124c4
|
|
| BLAKE2b-256 |
086a81aca19d047ebdee1114bd0c9ade890d6df93902f408f408a7e0d0ee6119
|
Provenance
The following attestation bundles were made for lautpy-0.0.3.0.tar.gz:
Publisher:
publish.yml on elimes/lautpy
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
lautpy-0.0.3.0.tar.gz -
Subject digest:
66376c1b98a83181ae8493dceea55e1dc8b9064dacd06cbc23c01af3d8220f4c - Sigstore transparency entry: 2733261720
- Sigstore integration time:
-
Permalink:
elimes/lautpy@1f441ac7974b6419b32bdfd058ed8a02e8e80eaa -
Branch / Tag:
refs/tags/v0.0.3.0 - Owner: https://github.com/elimes
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@1f441ac7974b6419b32bdfd058ed8a02e8e80eaa -
Trigger Event:
push
-
Statement type:
File details
Details for the file lautpy-0.0.3.0-py3-none-any.whl.
File metadata
- Download URL: lautpy-0.0.3.0-py3-none-any.whl
- Upload date:
- Size: 15.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e1e4acc8d5f364d4ba9b5ade4b1526871c9982619c4c38e4f7673783f280d403
|
|
| MD5 |
a714b263ea4099b7ea49cf1a437a853b
|
|
| BLAKE2b-256 |
83df64ad1d94237406914f40753d2ca3c4acc9741372821c1522ff3354192e4e
|
Provenance
The following attestation bundles were made for lautpy-0.0.3.0-py3-none-any.whl:
Publisher:
publish.yml on elimes/lautpy
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
lautpy-0.0.3.0-py3-none-any.whl -
Subject digest:
e1e4acc8d5f364d4ba9b5ade4b1526871c9982619c4c38e4f7673783f280d403 - Sigstore transparency entry: 2733261724
- Sigstore integration time:
-
Permalink:
elimes/lautpy@1f441ac7974b6419b32bdfd058ed8a02e8e80eaa -
Branch / Tag:
refs/tags/v0.0.3.0 - Owner: https://github.com/elimes
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@1f441ac7974b6419b32bdfd058ed8a02e8e80eaa -
Trigger Event:
push
-
Statement type: