Skip to content

Commit 55e25cb

Browse files
author
Tommaso Adani
committed
lint: Fixed linting issues
1 parent 568ef65 commit 55e25cb

2 files changed

Lines changed: 10 additions & 28 deletions

File tree

scripts/detect_affected_models.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -51,16 +51,12 @@
5151
# Task files are resolved by string-based lookup at runtime (not Python
5252
# imports), so the import graph cannot trace task → model dependencies.
5353
# Keep tasks/ as shared_infra until a task→model_type mapping exists.
54-
_SHARED_INFRA_PREFIXES = (
55-
"src/mobius/tasks/",
56-
)
54+
_SHARED_INFRA_PREFIXES = ("src/mobius/tasks/",)
5755

5856
# Traceable infrastructure: component files that are analyzed via the
5957
# import graph to find which models they actually affect, rather than
6058
# triggering run_all unconditionally.
61-
_TRACEABLE_PREFIXES = (
62-
"src/mobius/components/",
63-
)
59+
_TRACEABLE_PREFIXES = ("src/mobius/components/",)
6460

6561

6662
def classify_file(path: str) -> str:

scripts/detect_affected_models_test.py

Lines changed: 8 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,12 @@
1919
sys.path.insert(0, str(_SCRIPTS_DIR))
2020

2121
from detect_affected_models import ( # noqa: E402
22+
_SRC_ROOT,
2223
_build_class_to_source_module,
2324
_build_import_graph,
2425
_build_registry_class_to_types,
2526
_build_source_module_to_types,
2627
_find_reverse_dependents,
27-
_SRC_ROOT,
2828
classify_file,
2929
detect_affected_models,
3030
)
@@ -287,9 +287,7 @@ def test_shared_infra_still_triggers_run_all(self):
287287
"tests/_test_configs.py",
288288
]:
289289
result = detect_affected_models([path])
290-
assert result["run_all"] is True, (
291-
f"{path} should trigger run_all but didn't"
292-
)
290+
assert result["run_all"] is True, f"{path} should trigger run_all but didn't"
293291

294292
def test_traceable_and_model_combined(self):
295293
"""A component + model file change returns union of affected types."""
@@ -316,9 +314,7 @@ def test_traceable_overridden_by_shared_infra(self):
316314

317315
def test_deleted_traceable_file_triggers_run_all(self):
318316
"""A deleted component file triggers run_all (conservative)."""
319-
result = detect_affected_models(
320-
["src/mobius/components/_nonexistent_component.py"]
321-
)
317+
result = detect_affected_models(["src/mobius/components/_nonexistent_component.py"])
322318
assert result["run_all"] is True
323319

324320

@@ -335,33 +331,23 @@ def test_attention_component_finds_model_dependents(self):
335331
import_graph = _build_import_graph(_SRC_ROOT)
336332
registry_map = _build_source_module_to_types()
337333

338-
dependents = _find_reverse_dependents(
339-
"mobius.components._attention", import_graph
340-
)
334+
dependents = _find_reverse_dependents("mobius.components._attention", import_graph)
341335
# At minimum, models that use Attention should appear
342336
affected_types: set[str] = set()
343337
for dep in dependents:
344338
if dep in registry_map:
345339
affected_types.update(registry_map[dep])
346-
assert len(affected_types) > 0, (
347-
"Expected _attention.py to affect at least one model"
348-
)
340+
assert len(affected_types) > 0, "Expected _attention.py to affect at least one model"
349341

350342
def test_traceable_result_is_subset_of_all_models(self):
351343
"""Traceable tracing should return a subset, not all models."""
352344
# A niche component should affect fewer models than _common.py
353-
result_common = detect_affected_models(
354-
["src/mobius/components/_common.py"]
355-
)
356-
result_niche = detect_affected_models(
357-
["src/mobius/components/_sam_vision.py"]
358-
)
345+
result_common = detect_affected_models(["src/mobius/components/_common.py"])
346+
result_niche = detect_affected_models(["src/mobius/components/_sam_vision.py"])
359347
assert result_common["run_all"] is False
360348
assert result_niche["run_all"] is False
361349
# Niche component should affect fewer models
362-
assert len(result_niche["affected"]) <= len(
363-
result_common["affected"]
364-
), (
350+
assert len(result_niche["affected"]) <= len(result_common["affected"]), (
365351
f"_sam_vision.py ({len(result_niche['affected'])} models) should "
366352
f"affect <= models than _common.py ({len(result_common['affected'])})"
367353
)

0 commit comments

Comments
 (0)