샘플
iniconfig 2.3.0: IniConfig, ParseError, iscommentline
검증된 샘플 — pypi iniconfig 2.3.0: IniConfig, ParseError, iscommentline. python 3.12 · linux alpine/x64 · docker에서 contract를 실행해 통과했습니다.
sha256:26255b3d13627d7d0976a10a4e5efd655efa5647670bc1f2788391d6545def06
이 네트워크가 제공하는 것은 하나입니다. 빌드되는 샘플. 샌드박스에서 돌리고 서명된 영수증을 보관합니다. 등급을 매기지 않고 무엇도 보증하지 않습니다 — 같은 코드가 당신 환경에서 빌드되는지는 측정한 적이 없습니다.
통과한 계약 영수증을 낸 서로 다른 서명 키의 수입니다. 하나면 작성자 혼자이고, 둘 이상이면 다른 사람도 빌드했다는 뜻입니다. 키는 스스로 만드는 것이고 뒤에 등록된 신원이 없으므로, 세는 것은 사람이 아니라 키입니다.
MIT-0
실행 증거
선언된 환경과 서명된 실행을 분리해 두었습니다. 이 샘플이 무엇을 어디서 실행했는지 그대로 볼 수 있습니다.
- 증거 기준
- 서명된 컨트랙트 통과
- 검증 영수증
- 1
- 빌드한 서명 키
- 1
선언된 환경
python linux 24 · ubuntu · glibc 2.39 x64 python python pip
검증 실행 환경
| 환경 | 컨트랙트 | 단계 | 실행일 |
|---|---|---|---|
| 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-28 |
케이스
HOW- 목표
- verify pkg:pypi/iniconfig@2.3.0
- 패키지
- 심벌
-
- iniconfig.IniConfig
- iniconfig.ParseError
- iniconfig.iscommentline
- iniconfig.COMMENTCHARS
- 환경
- python
- 생성일
- 2026-08-28T03:38:35Z
컨트랙트
- IniConfig parses INI-formatted text and section blocks into dictionary-like sections accessible by name.
- SectionWrapper and IniConfig support typed value conversion via get(..., convert=type) and default fallback values.
- IniConfig.lineof and SectionWrapper.lineof return source line numbers for section headers and specific keys.
- iscommentline correctly identifies comment lines prefixed by COMMENTCHARS ('#' or ';') as well as empty lines.
- IniConfig raises ParseError with lineno, path, and message attributes on malformed syntax without section header.
파일
- NOTES.md
- PROMPT.md
- csx.json
- requirements.txt
- spec.json
- test/contract.py
소스
# iniconfig INI Parsing and Configuration
This sample pins `iniconfig` 2.3.0 and verifies core `IniConfig`, `ParseError`, `iscommentline`, and line tracking capabilities.
The contract verifies:
- `IniConfig` parses INI-formatted text with section headers into dictionary-like sections.
- Sections and `IniConfig` support typed value conversions via `get(..., convert=type)` and fallback defaults.
- Source line number tracking via `lineof()` for both section headers and individual keys.
- Comment line detection using `iscommentline()` with standard comment characters `#` and `;`.
- Raising `ParseError` containing error message, line number, and path when invalid INI content is parsed.
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/iniconfig@2.3.0
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:pypi/iniconfig@2.3.0
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:84e295e9f2f9215cefbc288518e5c55de24ed7b702548ebeabf8683796489acb","contract":["IniConfig parses INI-formatted text and section blocks into dictionary-like sections accessible by name.","SectionWrapper and IniConfig support typed value conversion via get(..., convert=type) and default fallback values.","IniConfig.lineof and SectionWrapper.lineof return source line numbers for section headers and specific keys.","iscommentline correctly identifies comment lines prefixed by COMMENTCHARS ('#' or ';') as well as empty lines.","IniConfig raises ParseError with lineno, path, and message attributes on malformed syntax without section header."],"goal":"verify pkg:pypi/iniconfig@2.3.0","kind":"HOW","packages":["pkg:pypi/iniconfig@2.3.0"],"schemaVersion":1,"symbols":["iniconfig.IniConfig","iniconfig.ParseError","iniconfig.iscommentline","iniconfig.COMMENTCHARS"]},"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/iniconfig@2.3.0"],"schemaVersion":1,"subject":"pkg:pypi/iniconfig@2.3.0","symbols":["iniconfig.IniConfig","iniconfig.ParseError","iniconfig.iscommentline","iniconfig.COMMENTCHARS"],"verifierAdapter":"python@1"}
iniconfig==2.3.0
{
"schemaVersion": 1,
"goal": "verify pkg:pypi/iniconfig@2.3.0",
"kind": "HOW",
"packages": [
"pkg:pypi/iniconfig@2.3.0"
],
"symbols": [
"iniconfig.IniConfig",
"iniconfig.ParseError",
"iniconfig.iscommentline",
"iniconfig.COMMENTCHARS"
]
}
import iniconfig
ini_content = """# Global comment
[app]
name = SampleApp
port = 8080
debug = true
multiline = line1
line2
; Another section
[database]
host = 127.0.0.1
max_connections = 50
"""
ini = iniconfig.IniConfig("test.ini", ini_content)
# 1. Section membership and iteration
assert "app" in ini
assert "database" in ini
assert "nonexistent" not in ini
assert len(ini.sections) == 2
section_names = [sec.name for sec in ini]
assert section_names == ["app", "database"]
# 2. Section indexing and items
app_sec = ini["app"]
assert app_sec.name == "app"
assert app_sec["name"] == "SampleApp"
assert app_sec["port"] == "8080"
assert app_sec["multiline"] == "line1\nline2"
assert list(app_sec) == ["name", "port", "debug", "multiline"]
items_dict = dict(app_sec.items())
assert items_dict["name"] == "SampleApp"
assert items_dict["port"] == "8080"
# 3. Value conversion and default fallbacks
assert app_sec.get("port", convert=int) == 8080
assert app_sec.get("missing_key", default="default_val") == "default_val"
assert ini.get("database", "host") == "127.0.0.1"
assert ini.get("database", "max_connections", convert=int) == 50
assert ini.get("database", "missing", default=100, convert=int) == 100
assert ini.get("nonexistent", "key", default="fallback") == "fallback"
# 4. Source line tracking with lineof
assert ini.lineof("app") == 2
assert ini.lineof("app", "name") == 3
assert ini.lineof("app", "port") == 4
assert app_sec.lineof("port") == 4
assert ini.lineof("database") == 10
assert ini.lineof("database", "host") == 11
# 5. Comment detection and COMMENTCHARS
assert "#" in iniconfig.COMMENTCHARS and ";" in iniconfig.COMMENTCHARS
assert iniconfig.iscommentline("# This is a comment") is True
assert iniconfig.iscommentline("; This is also a comment") is True
assert iniconfig.iscommentline(" # Indented comment") is True
assert iniconfig.iscommentline("name = value") is False
assert iniconfig.iscommentline("") is True
# 6. ParseError on invalid syntax
try:
iniconfig.IniConfig("invalid.ini", "key_without_section = value")
raise AssertionError("Expected ParseError when key appears before section header")
except iniconfig.ParseError as err:
assert err.path == "invalid.ini"
assert err.lineno == 0
assert "no section header" in str(err.msg).lower() or "no section header" in str(err).lower()
print("CONTRACT PASS: iniconfig@2.3.0 verified offline")
오리진 시더
익명