Skip to content

Commit 2a48841

Browse files
dmealingclaude
andcommitted
chore(python): pre-merge simplifier pass — FR5a polish
- errors.py: unquote `Optional[ErrorSource]` annotation (redundant under `from __future__ import annotations`; matches sibling annotations in this file). - error_source.py: unquote `ClassVar[CodeSource]` self-reference (same reason) and trim the verbose multi-line forward-declaration comment to a single-line WHY note. Conservative diff: two annotation cleanups + one comment trim. No behavior change; 496/496 Python tests stay green. Lazy import in semantic_diff was verified necessary (eager import reproduces the circular-import ImportError) and left as-is. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 78ff0b8 commit 2a48841

2 files changed

Lines changed: 5 additions & 7 deletions

File tree

server/python/src/metaobjects/errors.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ def __init__(
6666
code: ErrorCode = ErrorCode.ERR_UNKNOWN,
6767
source: str | None = None,
6868
path: str | None = None,
69-
envelope: "Optional[ErrorSource]" = None,
69+
envelope: Optional[ErrorSource] = None,
7070
) -> None:
7171
self.message = message
7272
self.code = code

server/python/src/metaobjects/source/error_source.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -147,12 +147,10 @@ class CodeSource(ErrorSource):
147147
caller: Optional[str] = None
148148
format: ClassVar[str] = "code"
149149

150-
# Canonical singleton for the no-caller case. Frozen dataclasses are
151-
# hash-equal across instances, but a single shared default makes intent
152-
# explicit and matches the C# `CodeSource.Default` convention. Declared
153-
# here as a forward reference so static analyzers see `CodeSource.DEFAULT`
154-
# as a `CodeSource` (the assignment lives below).
155-
DEFAULT: ClassVar["CodeSource"]
150+
# Canonical singleton for the no-caller case (mirrors C# `CodeSource.Default`).
151+
# The actual assignment lives below — Python doesn't allow self-reference in
152+
# the dataclass body.
153+
DEFAULT: ClassVar[CodeSource]
156154

157155

158156
CodeSource.DEFAULT = CodeSource(caller=None)

0 commit comments

Comments
 (0)