Skip to main content

pyrule

English | 中文

保序且区分类型的列表去重。

安装

pip install pyrule

用法

from pyrule import dedupe, dedupe_key

dedupe(["b", "a", "b"])                  # ['b', 'a']
dedupe([1, 1.0, True])                   # [1, 1.0, True]
dedupe([{"a": 1}, {"a": 1}, {"a": 2}])   # two dicts kept
dedupe_key(1), dedupe_key(1.0)           # ('int', '1'), ('float', '1.0')

说明

标量按 (类型名, 值) 判重,所以 1、1.0、True 保持三条——从 CSV / JSON / 数据库出来的就是这样;其余类型按规范化 JSON 判重,字段顺序不同视为同一条。

许可证

MIT


English

Order-preserving, type-aware deduplication for mixed lists.

Install

pip install pyrule

Usage

from pyrule import dedupe, dedupe_key

dedupe(["b", "a", "b"])                  # ['b', 'a']
dedupe([1, 1.0, True])                   # [1, 1.0, True]
dedupe([{"a": 1}, {"a": 1}, {"a": 2}])   # two dicts kept
dedupe_key(1), dedupe_key(1.0)           # ('int', '1'), ('float', '1.0')

Notes

Scalars are keyed by (type name, repr) so 1, 1.0 and True stay distinct — that is how they arrive from CSV, JSON and SQL. Other values are keyed by canonical JSON, so key order does not matter.

License

MIT

Metadata

Release files for pyrule 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 pyrule 0.0.4
File Size Uploaded Provenance
pyrule-0.0.4.tar.gz 3.4 kB Without provenance Details

Built distribution (wheel)

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

Total release size: 7.0 kB

Release files / pyrule-0.0.4.tar.gz

Download URL pyrule-0.0.4.tar.gz
Size 3.4 kB
Tags Source
SHA-256 checksum
How to use checksums
249b617d529a1ff560dd91c7022e0c71216d0b89a39223387ec555909e68d718
BLAKE2b-256 checksum
How to use checksums
58016ea64a6f7a01cf155edd26a45bf7fb9c996c7f9033be5b91104fdce7c6a7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.10.11

Release files / pyrule-0.0.4-py3-none-any.whl

Download URL pyrule-0.0.4-py3-none-any.whl
Size 3.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b8470ea403f24e8c7bc36c594157eef50bdb57bda7c7bedfdb001f561d720035
BLAKE2b-256 checksum
How to use checksums
02c471797785186dc73ae41093a5797b7a299a78b4fc9c7b88069bee1471cb14
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.10.11

Security for pyrule 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.

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