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

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.3
File Size Uploaded Provenance
pyrule-0.0.3.tar.gz 3.4 kB Without provenance Details

Built distribution (wheel)

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

Total release size: 7.0 kB

Release files / pyrule-0.0.3.tar.gz

Download URL pyrule-0.0.3.tar.gz
Size 3.4 kB
Tags Source
SHA-256 checksum
How to use checksums
c0aedcb0e74d9268944ecb00a4cac63f5e43843f1f8ce109aa2ff48569612daa
BLAKE2b-256 checksum
How to use checksums
73455ae9845d5ea405f760f61402df511ccd43aae3d12fdb50eec7621ffc06a4
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.3-py3-none-any.whl

Download URL pyrule-0.0.3-py3-none-any.whl
Size 3.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f72590da9ebce0d4ea7300347a0fead874f4ce2bc29e45e5bd24fd27eb1c2889
BLAKE2b-256 checksum
How to use checksums
539ba4b7ea6e93cfc49ffac1dab2b8034bc839e214947c08933f6effc5bbc3e6
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.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.

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