pyrulecc
English | 中文
用数据描述筛选条件,按字段匹配记录,支持点号路径。
安装
pip install pyrulecc
用法
from pyrulecc import filter_records, match_record
row = {"name": "alice", "age": 30, "org": {"code": "A1"}}
match_record(row, {"age": (">=", 18)}) # True
match_record(row, {"name": ("contains", "li")}) # True
match_record(row, {"org.code": "A1"}) # True
rows = [{"n": 1}, {"n": 5}, {"n": 9}]
filter_records(rows, {"n": (">", 2)}) # [{'n': 5}, {'n': 9}]
说明
规则值可以写裸值(等价 eq)或 (运算符, 值);键支持 a.b 形式的嵌套路径。记录缺少该字段时永不匹配——带洞的数据不该被静默放行。未知运算符抛 ValueError。
许可证
MIT
English
Evaluate field conditions against records, with dotted paths.
Install
pip install pyrulecc
Usage
from pyrulecc import filter_records, match_record
row = {"name": "alice", "age": 30, "org": {"code": "A1"}}
match_record(row, {"age": (">=", 18)}) # True
match_record(row, {"name": ("contains", "li")}) # True
match_record(row, {"org.code": "A1"}) # True
rows = [{"n": 1}, {"n": 5}, {"n": 9}]
filter_records(rows, {"n": (">", 2)}) # [{'n': 5}, {'n': 9}]
Notes
A rule value is either a bare value (means eq) or an (operator, value) pair. Keys may be dotted paths into nested dicts. A missing field never matches, and an unknown operator raises ValueError.
License
MIT
Metadata
Release files for pyrulecc 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 |
|---|---|---|---|---|
| pyrulecc-0.0.3.tar.gz | 3.9 kB | Without provenance | Details for pyrulecc-0.0.3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pyrulecc-0.0.3-py3-none-any.whl | Python 3 | none | any | Details for pyrulecc-0.0.3-py3-none-any.whl |
Total release size: 8.1 kB
Release files / pyrulecc-0.0.3.tar.gz
| Download URL | pyrulecc-0.0.3.tar.gz |
|---|---|
| Size | 3.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e24f3c389be4516478028a31427b9e49f3c47bf59319abd79ff2c08c55a054c6
|
|
BLAKE2b-256 checksum How to use checksums |
4a319c59318daa0c091bda6de930294d859eef1c2539cff9f5e4b968ec9b1e18
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.10.11
|
Release files / pyrulecc-0.0.3-py3-none-any.whl
| Download URL | pyrulecc-0.0.3-py3-none-any.whl |
|---|---|
| Size | 4.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ef31dbac45c2f89ebb229139b474a38956ff269ad5a336076e1de565c87a1fef
|
|
BLAKE2b-256 checksum How to use checksums |
c5f64f70597cd65cd20927cf8c64509a69c63dc697753f979dba7defa9b1289c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.10.11
|
Security for pyrulecc 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.