サンプル
typing-extensions 4.16.0: typing_extensions.get_args
検証済みサンプル — pypi typing-extensions 4.16.0: typing_extensions.get_args. python 3.12 · linux debian/x64 · docker で contract を実行し、成功しました.
sha256:63def625ea6903c3882b9c676f3948a3ece3b9fddb498f362bdcb99e408f314c
このネットワークが提供するのは一つだけです。ビルドされるサンプル。サンドボックスで実行し、署名済みの受領証を保管します。等級はつけず、何も保証しません — 同じコードがあなたの環境でビルドされるかは測定していません。
合格した契約受領証を提出した異なる署名鍵の数です。1 なら作者だけ、2 以上なら他の誰かもビルドしています。鍵は自己生成で背後に登録された身元がないため、数えているのは人ではなく鍵です。
MIT-0
実行証拠
宣言された環境と署名済みの実行を分けてあります。このサンプルが何をどこで実行したかをそのまま確認できます。
- 証拠の基準
- 署名済みコントラクト合格
- 検証レシート
- 1
- ビルドした署名鍵
- 1
宣言された環境
python 3.12 linux 24 · ubuntu · glibc 2.39 x64 python 3.12 python pip
検証実行環境
| 環境 | コントラクト | ステージ | 実行日 |
|---|---|---|---|
| python 3.12 · linux debian/x64 · docker ed25519:c1973797be207ac4 | PASS | compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS CONTAINER_RUN · python@1python:3.12-slim@sha256:09f7da3bc104… |
2026-09-05 |
ケース
HOW- ゴール
- verify typing_extensions.get_args in pkg:pypi/typing-extensions@4.16.0
- パッケージ
- シンボル
-
- typing_extensions.get_args
- 環境
- python 3.12
- 作成日
- 2026-09-05T21:38:35Z
コントラクト
- typing_extensions.get_args extracts type arguments as a tuple for parameterized generic types like Dict and List
- typing_extensions.get_args returns constituent member types for Union and tuple elements including Ellipsis for Tuple
- typing_extensions.get_args unpacks argument types as a list and return type as second element for Callable types
- typing_extensions.get_args unwraps the underlying type followed by metadata elements for Annotated types
- typing_extensions.get_args extracts literal values as a tuple of elements for Literal types
- typing_extensions.get_args returns an empty tuple for non-generic types and unsubscripted generic aliases
ファイル
- PROMPT.md
- csx.json
- pyproject.toml
- requirements.txt
- spec.json
- src/inspector.py
- test/contract.py
- uv.lock
ソース
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 typing_extensions.get_args in pkg:pypi/typing-extensions@4.16.0
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:pypi/typing-extensions@4.16.0
Demonstrate these symbols/APIs:
- typing_extensions.get_args
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:b6245b898ba87432bc117066f823cba9552b91000ce214896002502d6c3bb17b","contract":["typing_extensions.get_args extracts type arguments as a tuple for parameterized generic types like Dict and List","typing_extensions.get_args returns constituent member types for Union and tuple elements including Ellipsis for Tuple","typing_extensions.get_args unpacks argument types as a list and return type as second element for Callable types","typing_extensions.get_args unwraps the underlying type followed by metadata elements for Annotated types","typing_extensions.get_args extracts literal values as a tuple of elements for Literal types","typing_extensions.get_args returns an empty tuple for non-generic types and unsubscripted generic aliases"],"goal":"verify typing_extensions.get_args in pkg:pypi/typing-extensions@4.16.0","kind":"HOW","packages":["pkg:pypi/typing-extensions@4.16.0"],"schemaVersion":1,"symbols":["typing_extensions.get_args"]},"contractCommand":["python","test/contract.py"],"environment":{"arch":"x64","distro":"ubuntu","ecosystem":"pypi","language":"python","libc":"glibc","libcVersion":"2.39","os":"linux","osVersionBucket":"24","packageManager":"pip","runtime":"python","runtimeVersion":"3.12","schemaVersion":1},"license":"MIT-0","packages":["pkg:pypi/typing-extensions@4.16.0"],"schemaVersion":1,"subject":"pkg:pypi/typing-extensions@4.16.0","symbols":["typing_extensions.get_args"],"verifierAdapter":"python@1"}
[project]
name = "sample-typing-extensions-get-args"
version = "0.1.0"
description = "Clean-room verification sample for typing_extensions.get_args in pkg:pypi/typing-extensions@4.16.0"
readme = "PROMPT.md"
requires-python = ">=3.10"
dependencies = [
"typing-extensions==4.16.0",
]
typing-extensions==4.16.0
{
"schemaVersion": 1,
"goal": "verify typing_extensions.get_args in pkg:pypi/typing-extensions@4.16.0",
"kind": "HOW",
"packages": [
"pkg:pypi/typing-extensions@4.16.0"
],
"symbols": [
"typing_extensions.get_args"
]
}
"""Type argument inspection utilities using typing_extensions.get_args."""
from typing import Any, Tuple
import typing_extensions
def extract_type_arguments(tp: Any) -> Tuple[Any, ...]:
"""Extract type arguments with substitutions performed from a type hint.
Args:
tp: A type hint or generic alias to inspect.
Returns:
A tuple of type arguments if tp is parameterized, or an empty tuple if tp
is not parameterized or not a generic type.
"""
return typing_extensions.get_args(tp)
"""Contract verification test for typing_extensions.get_args."""
import os
import sys
from typing import Callable, Dict, List, Literal, Tuple, Union
# Ensure repository root is on sys.path
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
import typing_extensions
from typing_extensions import Annotated, get_args
from src.inspector import extract_type_arguments
def test_generic_containers():
"""Verify get_args extracts type arguments as a tuple for parameterized generic types like Dict and List."""
dict_args = get_args(Dict[str, int])
assert dict_args == (str, int), f"Expected (str, int), got {dict_args}"
list_args = get_args(List[float])
assert list_args == (float,), f"Expected (float,), got {list_args}"
# Verify helper function matches
assert extract_type_arguments(Dict[str, int]) == (str, int)
assert extract_type_arguments(List[float]) == (float,)
def test_unions_and_tuples():
"""Verify get_args returns constituent member types for Union and tuple elements including Ellipsis for Tuple."""
union_args = get_args(Union[int, str])
assert union_args == (int, str), f"Expected (int, str), got {union_args}"
var_tuple_args = get_args(Tuple[int, ...])
assert var_tuple_args == (int, Ellipsis), f"Expected (int, Ellipsis), got {var_tuple_args}"
fixed_tuple_args = get_args(Tuple[int, str, bool])
assert fixed_tuple_args == (int, str, bool), f"Expected (int, str, bool), got {fixed_tuple_args}"
assert extract_type_arguments(Union[int, str]) == (int, str)
assert extract_type_arguments(Tuple[int, ...]) == (int, Ellipsis)
def test_callable_signature():
"""Verify get_args unpacks argument types as a list and return type as second element for Callable types."""
callable_args = get_args(Callable[[int, str], bool])
assert callable_args == ([int, str], bool), f"Expected ([int, str], bool), got {callable_args}"
empty_callable_args = get_args(Callable[[], None])
assert empty_callable_args == ([], type(None)), f"Expected ([], type(None)), got {empty_callable_args}"
assert extract_type_arguments(Callable[[int, str], bool]) == ([int, str], bool)
def test_annotated_metadata():
"""Verify get_args unwraps the underlying type followed by metadata elements for Annotated types."""
annotated_args = get_args(Annotated[int, "positive", 100])
assert annotated_args == (int, "positive", 100), f"Expected (int, 'positive', 100), got {annotated_args}"
assert extract_type_arguments(Annotated[int, "positive", 100]) == (int, "positive", 100)
def test_literal_values():
"""Verify get_args extracts literal values as a tuple of elements for Literal types."""
literal_args = get_args(Literal["read", "write", "append"])
assert literal_args == ("read", "write", "append"), f"Expected ('read', 'write', 'append'), got {literal_args}"
assert extract_type_arguments(Literal["read", "write", "append"]) == ("read", "write", "append")
def test_non_generic_types():
"""Verify get_args returns an empty tuple for non-generic types and unsubscripted generic aliases."""
for non_generic in (int, str, list, List, object, None):
args = get_args(non_generic)
assert args == (), f"Expected () for {non_generic}, got {args}"
assert extract_type_arguments(non_generic) == ()
def main():
test_generic_containers()
test_unions_and_tuples()
test_callable_signature()
test_annotated_metadata()
test_literal_values()
test_non_generic_types()
print("Contract tests for typing_extensions.get_args passed successfully.")
return 0
if __name__ == "__main__":
sys.exit(main())
version = 1
revision = 3
requires-python = ">=3.10"
[[package]]
name = "sample-typing-extensions-get-args"
version = "0.1.0"
source = { virtual = "." }
dependencies = [
{ name = "typing-extensions" },
]
[package.metadata]
requires-dist = [{ name = "typing-extensions", specifier = "==4.16.0" }]
[[package]]
name = "typing-extensions"
version = "4.16.0"
source = { registry = "https://pypi.org/simple" }
sdist = { url = "https://files.pythonhosted.org/packages/f6/cc/6253133b5bb138fc3306cebfbda2c520f545d36b5be2c7255cc528bb45d6/typing_extensions-4.16.0.tar.gz", hash = "sha256:dc983d19a509c94dba722ee6abd33940f7c05a89e243c47e907eb4db6f1a43e5", size = 113555, upload-time = "2026-07-02T08:40:05.92Z" }
wheels = [
{ url = "https://files.pythonhosted.org/packages/49/d3/b8441a820a491ddfc024b0b0cf0393375b75ea13866d9c66727e54c2fc80/typing_extensions-4.16.0-py3-none-any.whl", hash = "sha256:481caa481374e813c1b176ada14e97f1f67a4539ce9cfeb3f350d78d6370c2e8", size = 45571, upload-time = "2026-07-02T08:40:04.659Z" },
]
オリジンシーダー
匿名