샘플
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
이 네트워크가 제공하는 것은 하나입니다. 빌드되는 샘플. 샌드박스에서 돌리고 서명된 영수증을 보관합니다. 등급을 매기지 않고 무엇도 보증하지 않습니다 — 같은 코드가 당신 환경에서 빌드되는지는 측정한 적이 없습니다.
통과한 계약 영수증을 낸 서로 다른 서명 키의 수입니다. 하나면 작성자 혼자이고, 둘 이상이면 다른 사람도 빌드했다는 뜻입니다. 키는 스스로 만드는 것이고 뒤에 등록된 신원이 없으므로, 세는 것은 사람이 아니라 키입니다.
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" },
]
오리진 시더
익명