샘플
pyyaml 6.0.3: yaml.error.YAMLError
검증된 샘플 — pypi pyyaml 6.0.3: yaml.error.YAMLError. python 3.12 · linux debian/x64 · docker에서 contract를 실행해 통과했습니다: yaml.error.YAMLError is the base exception…
sha256:107b3bf852f53babf1cc0889db8243abe65ce34430c79921768d24c2004a19f4
이 네트워크가 제공하는 것은 하나입니다. 빌드되는 샘플. 샌드박스에서 돌리고 서명된 영수증을 보관합니다. 등급을 매기지 않고 무엇도 보증하지 않습니다 — 같은 코드가 당신 환경에서 빌드되는지는 측정한 적이 없습니다.
통과한 계약 영수증을 낸 서로 다른 서명 키의 수입니다. 하나면 작성자 혼자이고, 둘 이상이면 다른 사람도 빌드했다는 뜻입니다. 키는 스스로 만드는 것이고 뒤에 등록된 신원이 없으므로, 세는 것은 사람이 아니라 키입니다.
MIT-0
실행 증거
선언된 환경과 서명된 실행을 분리해 두었습니다. 이 샘플이 무엇을 어디서 실행했는지 그대로 볼 수 있습니다.
- 증거 기준
- 서명된 컨트랙트 통과
- 검증 영수증
- 1
- 빌드한 서명 키
- 1
선언된 환경
python linux 24 · ubuntu · glibc 2.39 x64 python 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 yaml.error.YAMLError in pkg:pypi/pyyaml@6.0.3
- 패키지
- 심벌
-
- yaml.error.YAMLError
- 환경
- python
- 생성일
- 2026-09-05T18:51:58Z
컨트랙트
- yaml.error.YAMLError is the base exception class in PyYAML inheriting from Exception and aliased as yaml.YAMLError.
- Parsing malformed YAML mapping syntax raises ScannerError, which is caught by except yaml.error.YAMLError.
- Parsing unclosed flow collections raises ParserError, which is caught by except yaml.error.YAMLError.
- Parsing unrecognized custom tags raises ConstructorError, which is caught by except yaml.error.YAMLError.
- yaml.error.YAMLError can be directly instantiated with a message and subclassed for custom application error hierarchies.
파일
- NOTES.md
- PROMPT.md
- csx.json
- requirements.txt
- spec.json
- test/contract.py
소스
# PyYAML YAMLError exception hierarchy and handling
This sample pins `pyyaml` 6.0.3 and verifies `yaml.error.YAMLError` as the root exception class for all YAML parsing and processing errors.
The contract verifies:
- `yaml.error.YAMLError` is a base exception inheriting from standard `Exception` and is aliased at package top-level as `yaml.YAMLError`.
- `yaml.scanner.ScannerError` (malformed YAML tokens/mapping syntax) inherits from `yaml.error.MarkedYAMLError` and is caught by `except yaml.error.YAMLError`.
- `yaml.parser.ParserError` (unclosed flow collections and parsing anomalies) inherits from `yaml.error.MarkedYAMLError` and is caught by `except yaml.error.YAMLError`.
- `yaml.constructor.ConstructorError` (unrecognized custom tags) inherits from `yaml.error.MarkedYAMLError` and is caught by `except yaml.error.YAMLError`.
- `yaml.error.YAMLError` supports direct instantiation with custom error messages and serves as a base class for custom application-level YAML exception handling.
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 yaml.error.YAMLError in pkg:pypi/pyyaml@6.0.3
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:pypi/pyyaml@6.0.3
Demonstrate these symbols/APIs:
- yaml.error.YAMLError
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:102957266350072468958aaf42b547673b11df9109c81e89517c13770d8d5e0c","contract":["yaml.error.YAMLError is the base exception class in PyYAML inheriting from Exception and aliased as yaml.YAMLError.","Parsing malformed YAML mapping syntax raises ScannerError, which is caught by except yaml.error.YAMLError.","Parsing unclosed flow collections raises ParserError, which is caught by except yaml.error.YAMLError.","Parsing unrecognized custom tags raises ConstructorError, which is caught by except yaml.error.YAMLError.","yaml.error.YAMLError can be directly instantiated with a message and subclassed for custom application error hierarchies."],"goal":"verify yaml.error.YAMLError in pkg:pypi/pyyaml@6.0.3","kind":"HOW","packages":["pkg:pypi/pyyaml@6.0.3"],"schemaVersion":1,"symbols":["yaml.error.YAMLError"]},"contractCommand":["python","test/contract.py"],"environment":{"arch":"x64","distro":"ubuntu","ecosystem":"pypi","executionContext":"python","language":"python","libc":"glibc","libcVersion":"2.39","os":"linux","osVersionBucket":"24","packageManager":"pip","runtime":"python","schemaVersion":1},"license":"MIT-0","packages":["pkg:pypi/pyyaml@6.0.3"],"schemaVersion":1,"subject":"pkg:pypi/pyyaml@6.0.3","symbols":["yaml.error.YAMLError"],"verifierAdapter":"python@1"}
pyyaml==6.0.3
{
"schemaVersion": 1,
"goal": "verify yaml.error.YAMLError in pkg:pypi/pyyaml@6.0.3",
"kind": "HOW",
"packages": [
"pkg:pypi/pyyaml@6.0.3"
],
"symbols": [
"yaml.error.YAMLError"
]
}
import yaml
import yaml.error
import yaml.scanner
import yaml.parser
import yaml.constructor
# 1. Base exception inheritance and top-level alias
assert issubclass(yaml.error.YAMLError, Exception), "YAMLError must subclass Exception"
assert yaml.error.YAMLError is yaml.YAMLError, "yaml.error.YAMLError must be aliased as yaml.YAMLError"
assert issubclass(yaml.error.MarkedYAMLError, yaml.error.YAMLError), "MarkedYAMLError must subclass YAMLError"
# 2. ScannerError handling (syntax / mapping parsing failure)
try:
yaml.safe_load("key: : value")
raise AssertionError("expected ScannerError on invalid mapping syntax")
except yaml.error.YAMLError as exc:
assert isinstance(exc, yaml.scanner.ScannerError), f"expected ScannerError, got {type(exc)}"
assert isinstance(exc, yaml.error.MarkedYAMLError), "ScannerError must inherit from MarkedYAMLError"
assert exc.problem is not None, "ScannerError must have a problem description"
assert exc.problem_mark is not None, "ScannerError must have problem position mark"
# 3. ParserError handling (unclosed flow collection)
try:
yaml.safe_load("{key: val,")
raise AssertionError("expected ParserError on unclosed flow mapping")
except yaml.error.YAMLError as exc:
assert isinstance(exc, yaml.parser.ParserError), f"expected ParserError, got {type(exc)}"
assert isinstance(exc, yaml.error.MarkedYAMLError), "ParserError must inherit from MarkedYAMLError"
assert exc.problem is not None, "ParserError must have a problem description"
# 4. ConstructorError handling (unsupported custom YAML tag)
try:
yaml.safe_load("!unsupported_tag [1, 2, 3]")
raise AssertionError("expected ConstructorError on unrecognized YAML tag")
except yaml.error.YAMLError as exc:
assert isinstance(exc, yaml.constructor.ConstructorError), f"expected ConstructorError, got {type(exc)}"
assert isinstance(exc, yaml.error.MarkedYAMLError), "ConstructorError must inherit from MarkedYAMLError"
# 5. Direct instantiation and custom application subclassing
err = yaml.error.YAMLError("custom configuration error")
assert str(err) == "custom configuration error"
assert isinstance(err, yaml.error.YAMLError)
class AppConfigYamlError(yaml.error.YAMLError):
pass
try:
raise AppConfigYamlError("custom app config failed")
except yaml.error.YAMLError as exc:
assert isinstance(exc, AppConfigYamlError)
assert str(exc) == "custom app config failed"
print("CONTRACT PASS: yaml.error.YAMLError verified offline")
오리진 시더
익명