示例
rpds-py 2026.6.3: rpds.HashTrieMap, rpds.HashTrieSet, rpds.List
已验证示例 — pypi rpds-py 2026.6.3: rpds.HashTrieMap, rpds.HashTrieSet, rpds.List. contract 在 python 3.12 · linux alpine/x64 · docker 上运行并通过.
sha256:788a00dee2658c1c38e9231aba036b0323dfefe145ae9fe480e3fc1e4749baeb
本网络只提供一件事:能构建的样本。它在沙箱中运行并保留签名回执。它不评级、不担保——同样的代码能否在你的环境构建,它没有测量过。
提交了通过的契约回执的不同签名密钥数量。为 1 表示只有作者;大于 1 表示还有其他人构建过。密钥是自行生成的,背后没有注册身份,因此计的是密钥而非人。
MIT-0
执行证据
声明的环境与签名的运行分开呈现,你可以看到这个样本究竟运行了什么、在哪里运行。
- 证据依据
- 签名契约通过
- 验证回执
- 1
- 构建过它的签名密钥
- 1
声明的环境
python 3.12 linux 24 · ubuntu · glibc x64 python 3.12 python pip 24
验证运行环境
| 环境 | 契约 | 阶段 | 运行日期 |
|---|---|---|---|
| python 3.12 · linux alpine/x64 · docker ed25519:c1973797be207ac4 | PASS | compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS CONTAINER_RUN · python@1python:3.12-alpine@sha256:d09d15e60962… |
2026-08-27 |
案例
HOW- 目标
- verify pkg:pypi/rpds-py@2026.6.3
- 符号
-
- rpds.HashTrieMap
- rpds.HashTrieSet
- rpds.List
- rpds.Queue
- 环境
- python 3.12
- 创建时间
- 2026-08-27T18:41:03Z
契约
- assert HashTrieMap creates persistent mappings and supports insert, remove, discard, get, update, and convert
- assert HashTrieMap raises KeyError when accessing or removing missing keys
- assert HashTrieSet creates persistent sets and supports insert, remove, discard, union, intersection, difference, and symmetric_difference
- assert HashTrieSet raises KeyError when removing missing elements
- assert List creates persistent linked lists and supports push_front, drop_first, first, and rest
- assert List raises IndexError when accessing first or calling drop_first on an empty list
- assert Queue creates persistent FIFO queues and supports enqueue, dequeue, peek, and is_empty
- assert Queue raises IndexError when calling peek or dequeue on an empty queue
文件
- PROMPT.md
- csx.json
- pyproject.toml
- requirements.txt
- spec.json
- test/contract.py
源代码
Clean-room public code sample — generation instructions
Write a brand-new, minimal, self-contained code sample in this clean-room directory.
Do not copy, paraphrase, or reference any existing project source. Work only from this spec.
A csx.json manifest scaffold already exists. Do not recreate it from memory. Preserve its case.goal, packages and symbols; fill its empty case.contract with exact assertions and correct its environment, commands and verifierAdapter for the files you generate.
Goal: verify pkg:pypi/rpds-py@2026.6.3
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:pypi/rpds-py@2026.6.3
Constraints:
- executionContext: node
Required runtime conditions:
- ecosystem: npm
- language: javascript
- moduleSystem: cjs
- packageManager: npm@10.9.8
- runtime: node@22.23.2
Rules:
- One focused purpose; the smallest project that proves the goal.
- Include a contract test (test/contract.*) that runs OFFLINE and exits 0 exactly when the goal behavior works.
- Pin every dependency with a lockfile so resolution is reproducible.
- No secrets, credentials, or tokens. No real URLs (only example.com or localhost). No absolute paths.
- No personal names, emails, company names, or project identifiers of any kind.
- No binaries and no generated output (node_modules, dist, target, venv, .git, .env).
- Keep it under 200 files and 256KB packed.
{"case":{"caseId":"case:sha256:84beb09d56624973aeffb8dc6ad799ecbdac5ec2075a60feeddf6f62111200e6","constraints":{"executionContext":"python"},"contract":["assert HashTrieMap creates persistent mappings and supports insert, remove, discard, get, update, and convert","assert HashTrieMap raises KeyError when accessing or removing missing keys","assert HashTrieSet creates persistent sets and supports insert, remove, discard, union, intersection, difference, and symmetric_difference","assert HashTrieSet raises KeyError when removing missing elements","assert List creates persistent linked lists and supports push_front, drop_first, first, and rest","assert List raises IndexError when accessing first or calling drop_first on an empty list","assert Queue creates persistent FIFO queues and supports enqueue, dequeue, peek, and is_empty","assert Queue raises IndexError when calling peek or dequeue on an empty queue"],"goal":"verify pkg:pypi/rpds-py@2026.6.3","kind":"HOW","packages":["pkg:pypi/rpds-py@2026.6.3"],"schemaVersion":1,"symbols":["rpds.HashTrieMap","rpds.HashTrieSet","rpds.List","rpds.Queue"]},"contractCommand":["python3","test/contract.py"],"environment":{"arch":"x64","distro":"ubuntu","ecosystem":"pypi","executionContext":"python","language":"python","libc":"glibc","moduleSystem":"standard","os":"linux","osVersionBucket":"24","packageManager":"pip","packageManagerVersion":"24.0","runtime":"python","runtimeVersion":"3.12","schemaVersion":1},"license":"MIT-0","packages":["pkg:pypi/rpds-py@2026.6.3"],"schemaVersion":1,"subject":"pkg:pypi/rpds-py@2026.6.3","symbols":["rpds.HashTrieMap","rpds.HashTrieSet","rpds.List","rpds.Queue"],"verifierAdapter":"python@1"}
[project]
name = "verify-rpds-py"
version = "0.1.0"
dependencies = [
"rpds-py==2026.6.3",
]
rpds-py==2026.6.3
{
"schemaVersion": 1,
"goal": "verify pkg:pypi/rpds-py@2026.6.3",
"kind": "HOW",
"packages": [
"pkg:pypi/rpds-py@2026.6.3"
],
"constraints": {
"executionContext": "node"
},
"runtimeConditions": {
"ecosystem": "npm",
"language": "javascript",
"moduleSystem": "cjs",
"packageManager": "npm@10.9.8",
"runtime": "node@22.23.2"
}
}
import rpds
from rpds import HashTrieMap, HashTrieSet, List, Queue
def test_hash_trie_map():
base = HashTrieMap({"k1": "v1", "k2": "v2"})
assert base["k1"] == "v1"
assert base.get("k2") == "v2"
assert base.get("k3", "default") == "default"
assert len(base) == 2
# Immutability / persistence upon insert
added = base.insert("k3", "v3")
assert len(added) == 3
assert added["k3"] == "v3"
assert len(base) == 2
assert "k3" not in base
# Immutability / persistence upon remove and discard
removed = added.remove("k1")
assert len(removed) == 2
assert "k1" not in removed
assert "k1" in added
discarded = base.discard("nonexistent_key")
assert discarded == base
# Update and convert
converted = HashTrieMap.convert({"x": 10, "y": 20})
assert converted["x"] == 10 and converted["y"] == 20
updated = base.update({"k2": "v2_updated", "k4": "v4"})
assert updated["k2"] == "v2_updated"
assert updated["k4"] == "v4"
assert base["k2"] == "v2"
# Missing key KeyError
try:
_ = base["missing"]
assert False, "Accessing missing key should raise KeyError"
except KeyError:
pass
try:
base.remove("missing")
assert False, "Removing missing key should raise KeyError"
except KeyError:
pass
def test_hash_trie_set():
base = HashTrieSet(["alpha", "beta"])
assert "alpha" in base
assert "beta" in base
assert "gamma" not in base
assert len(base) == 2
# Immutability / persistence upon insert
added = base.insert("gamma")
assert len(added) == 3
assert "gamma" in added
assert len(base) == 2
assert "gamma" not in base
# Immutability / persistence upon remove and discard
removed = added.remove("alpha")
assert len(removed) == 2
assert "alpha" not in removed
assert "alpha" in added
discarded = base.discard("nonexistent")
assert discarded == base
# Set operations
other = HashTrieSet(["beta", "delta"])
union_set = base.union(other)
assert len(union_set) == 3
assert "alpha" in union_set and "beta" in union_set and "delta" in union_set
inter_set = base.intersection(other)
assert len(inter_set) == 1
assert "beta" in inter_set
diff_set = base.difference(other)
assert len(diff_set) == 1
assert "alpha" in diff_set
sym_diff = base.symmetric_difference(other)
assert len(sym_diff) == 2
assert "alpha" in sym_diff and "delta" in sym_diff
# Missing element KeyError
try:
base.remove("missing")
assert False, "Removing missing element should raise KeyError"
except KeyError:
pass
def test_persistent_list():
base = List([1, 2, 3])
assert base.first == 1
assert base.rest == List([2, 3])
assert len(base) == 3
# Immutability / persistence upon push_front
pushed = base.push_front(0)
assert pushed.first == 0
assert len(pushed) == 4
assert len(base) == 3
assert base.first == 1
# drop_first
dropped = base.drop_first()
assert dropped == List([2, 3])
assert len(dropped) == 2
assert len(base) == 3
# Empty list raises IndexError
empty = List()
assert len(empty) == 0
try:
_ = empty.first
assert False, "Accessing first of empty List should raise IndexError"
except IndexError:
pass
try:
empty.drop_first()
assert False, "Calling drop_first on empty List should raise IndexError"
except IndexError:
pass
def test_persistent_queue():
empty_q = Queue()
assert empty_q.is_empty()
assert len(empty_q) == 0
# Immutability / persistence upon enqueue
q1 = empty_q.enqueue("item1")
assert not q1.is_empty()
assert len(q1) == 1
assert empty_q.is_empty()
q2 = q1.enqueue("item2")
assert q2.peek() == "item1"
assert len(q2) == 2
# Dequeue
q3 = q2.dequeue()
assert q3.peek() == "item2"
assert len(q3) == 1
assert len(q2) == 2
assert q2.peek() == "item1"
# Empty queue raises IndexError
try:
empty_q.peek()
assert False, "Calling peek on empty Queue should raise IndexError"
except IndexError:
pass
try:
empty_q.dequeue()
assert False, "Calling dequeue on empty Queue should raise IndexError"
except IndexError:
pass
def main():
test_hash_trie_map()
test_hash_trie_set()
test_persistent_list()
test_persistent_queue()
print("All contract assertions passed.")
if __name__ == "__main__":
main()
原始种子者
匿名