Skip to content

Commit

Permalink
Better typing to avoid fmt directive (#1306)
Browse files Browse the repository at this point in the history
  • Loading branch information
nnarayen authored Jan 10, 2025
1 parent 174bf94 commit e200c72
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions truss-chains/truss_chains/framework.py
Original file line number Diff line number Diff line change
Expand Up @@ -1016,14 +1016,13 @@ def _detect_naive_instantiations(
if up_func_name == _INIT_NAME and self_value == up_self_value:
continue # OK, call to `super().__init__()`.

# Everything else is invalid. We must turn formatting off because ruff
# attempts to move the ignore to an invalid line, causing mypy issues.
# fmt: off
# Everything else is invalid.
code_context = up_frame.code_context
assert code_context is not None
location = (
f"{up_frame.filename}:{up_frame.lineno} ({up_frame.function})\n"
f" {up_frame.code_context[0].strip()}" # type: ignore[index]
f" {code_context[0].strip()}"
)
# fmt: on
raise definitions.ChainsRuntimeError(
_instantiation_error_msg(chainlet_descriptor.name, location)
)
Expand Down

0 comments on commit e200c72

Please sign in to comment.