Skip to main content

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.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pyrulecc 0.0.4
File Size Uploaded Provenance Actions
pyrulecc-0.0.4.tar.gz 4.0 kB Without provenance Details for pyrulecc-0.0.4.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pyrulecc 0.0.4
File Interpreter ABI Platform Actions
pyrulecc-0.0.4-py3-none-any.whl Python 3 none any Details for pyrulecc-0.0.4-py3-none-any.whl

Total release size: 8.1 kB

Release files / pyrulecc-0.0.4.tar.gz

Download URL pyrulecc-0.0.4.tar.gz
Size 4.0 kB
Tags Source
SHA-256 checksum
How to use checksums
dddcace4bfc8a645e0e07e73d03b35da1462f253f4acc87a7621c6aa9bc0c34c
BLAKE2b-256 checksum
How to use checksums
50cbb632835ba408b65fb3711fedb3cde0976daed6a92eeeaa8a4e4cfa3acd78
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.4-py3-none-any.whl

Download URL pyrulecc-0.0.4-py3-none-any.whl
Size 4.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9ff1ed6db5143fa1471453b51106db8cb811ecaf1f08c51447201666df1c6b3a
BLAKE2b-256 checksum
How to use checksums
2b12bca0c9abaf1d02f16855f006fcc68b916946ec33bb2b02a08c41962a3588
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.4

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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page