diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2021-12-01 15:57:41 +0100 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2021-12-01 15:58:18 +0100 |
commit | 918764c1945bac55436f3da71196b81f7ae8751d (patch) | |
tree | cd37aa618887f5ae9664992f5d5ea0eeac90eaa0 /specview.py | |
parent | 7e0e2aa93a91b01cb5bbf4f1454b76a928fa947f (diff) |
specview.py: Make analyzer happy
Diffstat (limited to 'specview.py')
-rwxr-xr-x | specview.py | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/specview.py b/specview.py index 375f650b..8ad8f3c6 100755 --- a/specview.py +++ b/specview.py @@ -232,8 +232,13 @@ def _no_validation(item: Item, path: List[str], return path_2[:-1] +_REFINEMENTS = ["interface-function", "requirement-refinement"] + +_GROUPS = ["requirement/non-functional/design-group", "interface/group"] + + def _is_refinement(item: Item, other: Item) -> bool: - for parent in item.parents(["interface-function", "requirement-refinement"]): + for parent in item.parents(_REFINEMENTS): if parent == other: return True if _is_refinement(parent, other): @@ -241,14 +246,11 @@ def _is_refinement(item: Item, other: Item) -> bool: return False -_GROUPS = ["requirement/non-functional/design-group", "interface/group"] - - -def _gather_design_components(item: Item, components: List[str]) -> bool: +def _gather_design_components(item: Item, components: List[Item]) -> bool: if item.type in _GROUPS: components.append(item) return True - elif item.type.startswith("requirement"): + if item.type.startswith("requirement"): for parent in item.parents("interface-function"): components.append(parent) for parent in item.parents("requirement-refinement"): @@ -261,17 +263,17 @@ def _design(item_cache: ItemCache, enabled: List[str]) -> None: for item in item_cache.all.values(): if not item.is_enabled(enabled): continue - components = [] + components = [] # type: List[Item] if not _gather_design_components(item, components): continue - compact = set() + compact = set() # type: Set[Item] for component in components: for component_2 in components: if component != component_2: if _is_refinement(component_2, component): break else: - compact.add(component) + compact.add(component) if compact: text = ", ".join(component.uid for component in compact) else: @@ -403,7 +405,7 @@ def _gather_api_names(item: Item, names: List[str]) -> None: def _list_api(item_cache: ItemCache) -> None: - names = [] # List[str] + names = [] # type: List[str] _gather_api_names(item_cache["/if/domain"], names) _gather_api_names(item_cache["/acfg/if/domain"], names) for name in sorted(names): |