From 080ade25beb2363d87bd511eb99932445158963e Mon Sep 17 00:00:00 2001 From: HAL9000 Date: Sat, 9 May 2026 22:44:02 +0000 Subject: [PATCH] fix(acms): restore explicit UKO re-exports, fix type annotations, clean lint directives Restore explicit 'from cleveragents.acms.uko import (...)' block in __init__.py so that acms_skeleton_compressor.py can import CODE_DETAIL_LEVEL_MAP etc. Fix invalid dict[str, callable] annotation in robot helper to use collections.abc.Callable[[], None]. Remove unused noqa directives (E501, C901) now that ruff rules are stricter. --- .../steps/acms_budget_enforcement_steps.py | 4 +- robot/helper_acms_budget_enforcement.py | 6 +- src/cleveragents/acms/__init__.py | 56 +++++++++++++++++-- 3 files changed, 57 insertions(+), 9 deletions(-) diff --git a/features/steps/acms_budget_enforcement_steps.py b/features/steps/acms_budget_enforcement_steps.py index d28e8e483..46a061c74 100644 --- a/features/steps/acms_budget_enforcement_steps.py +++ b/features/steps/acms_budget_enforcement_steps.py @@ -12,7 +12,7 @@ def step_create_budget_enforcer_with_max_file_size( context: object, size: int ) -> None: """Create a fresh budget enforcer with specified max_file_size.""" - context.budget_enforcer = BudgetEnforcer(max_file_size=size, max_total_size=10000) # noqa: E501 + context.budget_enforcer = BudgetEnforcer(max_file_size=size, max_total_size=10000) context.file_counter = 0 @@ -29,7 +29,7 @@ def step_create_budget_enforcer_with_max_total_size( enforcer's constraint since both Background steps run sequentially. """ _max_file_size: int - if hasattr(context, "budget_enforcer") and context.budget_enforcer is not None: # noqa: E501 + if hasattr(context, "budget_enforcer") and context.budget_enforcer is not None: _max_file_size = context.budget_enforcer.max_file_size else: _max_file_size = 10000 diff --git a/robot/helper_acms_budget_enforcement.py b/robot/helper_acms_budget_enforcement.py index e4ec76e88..e4b869968 100644 --- a/robot/helper_acms_budget_enforcement.py +++ b/robot/helper_acms_budget_enforcement.py @@ -3,7 +3,7 @@ from __future__ import annotations import sys -from pathlib import Path +from collections.abc import Callable def _test_file_within_limit() -> None: @@ -241,7 +241,7 @@ def _test_assembled_context() -> None: print("assembled-context-ok") -_TESTS: dict[str, callable] = { +_TESTS: dict[str, Callable[[], None]] = { "file-within-limit": _test_file_within_limit, "file-exceeds-limit": _test_file_exceeds_limit, "total-size-cutoff": _test_total_size_cutoff, @@ -255,7 +255,7 @@ _TESTS: dict[str, callable] = { } -if __name__ == "__main__": # noqa: C901 +if __name__ == "__main__": if len(sys.argv) < 2 or sys.argv[1] not in _TESTS: print( f"Usage: {sys.argv[0]} <{'|'.join(sorted(_TESTS))}>", diff --git a/src/cleveragents/acms/__init__.py b/src/cleveragents/acms/__init__.py index ba7686ba9..869003818 100644 --- a/src/cleveragents/acms/__init__.py +++ b/src/cleveragents/acms/__init__.py @@ -19,9 +19,56 @@ from cleveragents.acms.index import ( IndexEntry, TierLevel, ) - -# Re-export UKO vocabulary symbols for convenience -_uko_exports: list[str] = list(_uko.__all__) +from cleveragents.acms.uko import ( + CODE_DETAIL_LEVEL_MAP, + FUNC_DETAIL_LEVEL_MAP, + JAVA_DETAIL_LEVELS, + JAVA_VOCABULARY, + OO_DETAIL_LEVEL_MAP, + PROC_DETAIL_LEVEL_MAP, + PYTHON_DETAIL_LEVELS, + PYTHON_VOCABULARY, + RUST_DETAIL_LEVELS, + RUST_VOCABULARY, + TYPESCRIPT_DETAIL_LEVELS, + TYPESCRIPT_VOCABULARY, + DetailLevelMapBuilder, + DuplicateVocabularyError, + JavaAnnotation, + JavaCheckedException, + JavaClass, + JavaInterface, + JavaMethod, + Layer2Dependency, + ParadigmVocabulary, + ProvenanceInfo, + PythonClass, + PythonDecorator, + PythonFunction, + PythonModule, + PythonTypeStub, + RustDeriveAttribute, + RustFunction, + RustImpl, + RustStruct, + RustTrait, + TypeScriptClass, + TypeScriptFunction, + TypeScriptInterface, + TypeScriptModule, + UKOClass, + UKOProperty, + UKOVocabulary, + VocabularyClass, + VocabularyProperty, + VocabularyRegistry, + build_detail_level_map, + build_effective_map, + get_func_vocabulary, + get_oo_vocabulary, + get_proc_vocabulary, + resolve_detail_level, +) # Index model exports _index_exports: list[str] = [ @@ -39,4 +86,5 @@ _budget_exports: list[str] = [ "ContextFile", ] -__all__: list[str] = _budget_exports + _uko_exports + _index_exports +# Full __all__ includes uko symbols (already bound as explicit imports) + index + budget +__all__: list[str] = list(_uko.__all__) + _index_exports + _budget_exports