Skip to content

Commit 3799728

Browse files
sbryngelsonclaude
andcommitted
Fix type annotations for requires_value and when_value support
- validate.py: condition_label is Optional[str] (None for when_set) - definitions.py: add annotations to inner _validate_condition closure - docs_gen.py: use generic Dict/List types for _format_requires_value and _format_condition Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 81d561d commit 3799728

3 files changed

Lines changed: 5 additions & 5 deletions

File tree

toolchain/mfc/params/definitions.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -408,7 +408,7 @@ def _validate_dependency(param_name: str, dependency: Dict[str, Any]) -> None:
408408
)
409409
)
410410

411-
def _validate_condition(cond_label, condition):
411+
def _validate_condition(cond_label: str, condition: Any) -> None:
412412
"""Validate a condition dict (shared by when_true, when_set, when_value entries)."""
413413
if not isinstance(condition, dict):
414414
raise ValueError(

toolchain/mfc/params/generators/docs_gen.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ def _format_constraints(param) -> str:
126126
return ", ".join(parts)
127127

128128

129-
def _format_requires_value(rv: dict) -> str:
129+
def _format_requires_value(rv: Dict[str, list]) -> str:
130130
"""Format a requires_value dict with human-readable labels."""
131131
items = []
132132
for param, vals in rv.items():
@@ -136,7 +136,7 @@ def _format_requires_value(rv: dict) -> str:
136136
return ", ".join(items)
137137

138138

139-
def _format_condition(trigger: str, condition: dict) -> list:
139+
def _format_condition(trigger: str, condition: Dict[str, Any]) -> List[str]:
140140
"""Format a single condition dict into a list of description strings."""
141141
parts = []
142142
if "requires" in condition:

toolchain/mfc/params/validate.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
3. Physics validation (via case_validator.py)
2828
"""
2929

30-
from typing import Dict, Any, List, Tuple
30+
from typing import Dict, Any, List, Optional, Tuple
3131
from .registry import REGISTRY
3232
from .errors import (
3333
dependency_error,
@@ -99,7 +99,7 @@ def validate_constraints(params: Dict[str, Any]) -> List[str]:
9999
def _check_condition( # pylint: disable=too-many-arguments
100100
name: str,
101101
condition: Dict[str, Any],
102-
condition_label: str,
102+
condition_label: Optional[str],
103103
params: Dict[str, Any],
104104
errors: List[str],
105105
warnings: List[str],

0 commit comments

Comments
 (0)