codex: revert Python SDK changes from PR #16274

This commit is contained in:
Eric Traut
2026-03-31 11:03:50 -06:00
parent 508c91c2c2
commit d6143dc64c
6 changed files with 31 additions and 205 deletions

View File

@@ -452,22 +452,9 @@ def generate_v2_all() -> None:
],
cwd=sdk_root(),
)
_widen_generated_personality_type(out_path)
_normalize_generated_timestamps(out_path)
def _widen_generated_personality_type(out_path: Path) -> None:
source = out_path.read_text()
updated = re.sub(
r"class Personality\(Enum\):\n(?: .+\n)+",
"Personality = str\n\n",
source,
count=1,
)
if updated != source:
out_path.write_text(updated)
def _notification_specs() -> list[tuple[str, str]]:
server_notifications = json.loads(
(schema_root_dir() / "ServerNotification.json").read_text()
@@ -557,11 +544,6 @@ FIELD_ANNOTATION_OVERRIDES: dict[str, str] = {
# Keep public API typed without falling back to `Any`.
"config": "JsonObject",
"output_schema": "JsonObject",
"personality": "PersonalityLike",
}
FIELD_SERIALIZATION_OVERRIDES: dict[str, str] = {
"personality": "personality_value(personality)",
}
@@ -654,11 +636,7 @@ def _kw_signature_lines(fields: list[PublicFieldSpec]) -> list[str]:
def _model_arg_lines(
fields: list[PublicFieldSpec], *, indent: str = " "
) -> list[str]:
lines = []
for field in fields:
value = FIELD_SERIALIZATION_OVERRIDES.get(field.wire_name, field.py_name)
lines.append(f"{indent}{field.wire_name}={value},")
return lines
return [f"{indent}{field.wire_name}={field.py_name}," for field in fields]
def _replace_generated_block(source: str, block_name: str, body: str) -> str: