Skip to content

Commit

Permalink
refactor: move RAMSTKFailureMode to its own package (#939)
Browse files Browse the repository at this point in the history
* refactor: move commondb.category to own package

* tests: update RAMSTKCategory tests

* style: update stub files

* style: update stub files

* style: sourcery cleanups

* refactor: move commondb.subcategory to own package

* tests: update subcategory tests

* style: add stub subcategory files

* refactor: move commondb.failure_mode to own package

* tests: update failure mode tests

* style: add failure mode stub files

* docs: update CHANGELOG.md

* refactor: split common database methods into smaller methods

* style: update stub files
  • Loading branch information
weibullguy committed Feb 1, 2022
1 parent f6c2cf1 commit f5e3a88
Show file tree
Hide file tree
Showing 17 changed files with 1,064 additions and 256 deletions.
29 changes: 3 additions & 26 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@

**Merged pull requests:**

- refactor: move RAMSTKSubCategory to its own package [\#937](https://github.com/ReliaQualAssociates/ramstk/pull/937) ([weibullguy](https://github.com/weibullguy))
- refactor: move RAMSTKCategory to its own package [\#933](https://github.com/ReliaQualAssociates/ramstk/pull/933) ([weibullguy](https://github.com/weibullguy))
- refactor: retire listviews and listbook [\#932](https://github.com/ReliaQualAssociates/ramstk/pull/932) ([weibullguy](https://github.com/weibullguy))
- refactor: move failure definitions to Function work view [\#931](https://github.com/ReliaQualAssociates/ramstk/pull/931) ([weibullguy](https://github.com/weibullguy))
- refactor: associate failure definitions with functions [\#930](https://github.com/ReliaQualAssociates/ramstk/pull/930) ([weibullguy](https://github.com/weibullguy))
- ci: lower case -s to sign tags [\#929](https://github.com/ReliaQualAssociates/ramstk/pull/929) ([weibullguy](https://github.com/weibullguy))
Expand All @@ -20,10 +23,6 @@ Bug Fixes

- fix: verification plan calculate all updates wrong records [\#924](https://github.com/ReliaQualAssociates/ramstk/pull/924) ([weibullguy](https://github.com/weibullguy))

**Merged pull requests:**

- release: v0.15.12 [\#925](https://github.com/ReliaQualAssociates/ramstk/pull/925) ([github-actions[bot]](https://github.com/apps/github-actions))

## [v0.15.11](https://github.com/ReliaQualAssociates/ramstk/tree/v0.15.11) (2022-01-28)

[Full Changelog](https://github.com/ReliaQualAssociates/ramstk/compare/v0.15.10...v0.15.11)
Expand All @@ -35,7 +34,6 @@ Bug Fixes

**Merged pull requests:**

- release: v0.15.11 [\#922](https://github.com/ReliaQualAssociates/ramstk/pull/922) ([github-actions[bot]](https://github.com/apps/github-actions))
- ci: add GPG key for auto actions [\#919](https://github.com/ReliaQualAssociates/ramstk/pull/919) ([weibullguy](https://github.com/weibullguy))

## [v0.15.10](https://github.com/ReliaQualAssociates/ramstk/tree/v0.15.10) (2022-01-27)
Expand All @@ -49,7 +47,6 @@ Bug Fixes

**Merged pull requests:**

- release: v0.15.10 [\#916](https://github.com/ReliaQualAssociates/ramstk/pull/916) ([github-actions[bot]](https://github.com/apps/github-actions))
- ci: update on-pr-open action to use git for finding version [\#913](https://github.com/ReliaQualAssociates/ramstk/pull/913) ([weibullguy](https://github.com/weibullguy))

## [v0.15.9](https://github.com/ReliaQualAssociates/ramstk/tree/v0.15.9) (2022-01-26)
Expand All @@ -62,7 +59,6 @@ Bug Fixes

**Merged pull requests:**

- release: v0.15.9 [\#905](https://github.com/ReliaQualAssociates/ramstk/pull/905) ([github-actions[bot]](https://github.com/apps/github-actions))
- refactor: remove unused methods [\#901](https://github.com/ReliaQualAssociates/ramstk/pull/901) ([weibullguy](https://github.com/weibullguy))

## [v0.15.8](https://github.com/ReliaQualAssociates/ramstk/tree/v0.15.8) (2022-01-25)
Expand All @@ -75,7 +71,6 @@ Bug Fixes

**Merged pull requests:**

- release: v0.15.8 [\#900](https://github.com/ReliaQualAssociates/ramstk/pull/900) ([github-actions[bot]](https://github.com/apps/github-actions))
- ci: add step to checkout repository [\#896](https://github.com/ReliaQualAssociates/ramstk/pull/896) ([weibullguy](https://github.com/weibullguy))
- refactor: update do\_set\_attributes\(\) node\_id argument to integer [\#894](https://github.com/ReliaQualAssociates/ramstk/pull/894) ([weibullguy](https://github.com/weibullguy))
- ci: update previous tag action [\#893](https://github.com/ReliaQualAssociates/ramstk/pull/893) ([weibullguy](https://github.com/weibullguy))
Expand All @@ -92,7 +87,6 @@ Bug Fixes
**Merged pull requests:**

- ci: update CHANGELOG.md when opening PR [\#888](https://github.com/ReliaQualAssociates/ramstk/pull/888) ([weibullguy](https://github.com/weibullguy))
- release: v0.15.7 [\#887](https://github.com/ReliaQualAssociates/ramstk/pull/887) ([github-actions[bot]](https://github.com/apps/github-actions))
- ci: update on-merge workflow to use ref [\#884](https://github.com/ReliaQualAssociates/ramstk/pull/884) ([weibullguy](https://github.com/weibullguy))

## [0.15.6](https://github.com/ReliaQualAssociates/ramstk/tree/0.15.6) (2022-01-23)
Expand All @@ -105,7 +99,6 @@ Bug Fixes

**Merged pull requests:**

- release: v0.15.6 [\#883](https://github.com/ReliaQualAssociates/ramstk/pull/883) ([github-actions[bot]](https://github.com/apps/github-actions))
- ci: move job to update version files to PR close workflow [\#880](https://github.com/ReliaQualAssociates/ramstk/pull/880) ([weibullguy](https://github.com/weibullguy))

## [v0.15.5](https://github.com/ReliaQualAssociates/ramstk/tree/v0.15.5) (2022-01-22)
Expand All @@ -119,7 +112,6 @@ Bug Fixes
**Merged pull requests:**

- ci: update workflows [\#879](https://github.com/ReliaQualAssociates/ramstk/pull/879) ([weibullguy](https://github.com/weibullguy))
- release: v0.15.5 [\#878](https://github.com/ReliaQualAssociates/ramstk/pull/878) ([github-actions[bot]](https://github.com/apps/github-actions))
- ci: move documentation build and deploy action to separate workflow [\#874](https://github.com/ReliaQualAssociates/ramstk/pull/874) ([weibullguy](https://github.com/weibullguy))

## [v0.15.4](https://github.com/ReliaQualAssociates/ramstk/tree/v0.15.4) (2022-01-20)
Expand All @@ -132,7 +124,6 @@ Bug Fixes

**Merged pull requests:**

- release: v0.15.4 [\#873](https://github.com/ReliaQualAssociates/ramstk/pull/873) ([github-actions[bot]](https://github.com/apps/github-actions))
- ci: update action workflows [\#870](https://github.com/ReliaQualAssociates/ramstk/pull/870) ([weibullguy](https://github.com/weibullguy))

## [v0.15.3](https://github.com/ReliaQualAssociates/ramstk/tree/v0.15.3) (2022-01-19)
Expand All @@ -148,7 +139,6 @@ Bug Fixes

**Merged pull requests:**

- release: v0.15.3 [\#869](https://github.com/ReliaQualAssociates/ramstk/pull/869) ([github-actions[bot]](https://github.com/apps/github-actions))
- ci: update action workflows [\#857](https://github.com/ReliaQualAssociates/ramstk/pull/857) ([weibullguy](https://github.com/weibullguy))

## [v0.15.2](https://github.com/ReliaQualAssociates/ramstk/tree/v0.15.2) (2022-01-10)
Expand All @@ -160,11 +150,6 @@ Bug Fixes
- ci: add step to label closed PR [\#855](https://github.com/ReliaQualAssociates/ramstk/pull/855) ([weibullguy](https://github.com/weibullguy))
- fix: load Allocation worksheet [\#851](https://github.com/ReliaQualAssociates/ramstk/pull/851) ([weibullguy](https://github.com/weibullguy))

**Merged pull requests:**

- release: v0.15.2 [\#856](https://github.com/ReliaQualAssociates/ramstk/pull/856) ([github-actions[bot]](https://github.com/apps/github-actions))
- ci: fix issue assign action [\#854](https://github.com/ReliaQualAssociates/ramstk/pull/854) ([weibullguy](https://github.com/weibullguy))

## [v0.15.1](https://github.com/ReliaQualAssociates/ramstk/tree/v0.15.1) (2022-01-09)

[Full Changelog](https://github.com/ReliaQualAssociates/ramstk/compare/v0.15.0...v0.15.1)
Expand All @@ -173,18 +158,10 @@ Bug Fixes

- fix: handle no server connection error [\#848](https://github.com/ReliaQualAssociates/ramstk/pull/848) ([weibullguy](https://github.com/weibullguy))

**Merged pull requests:**

- ci: set for release [\#849](https://github.com/ReliaQualAssociates/ramstk/pull/849) ([github-actions[bot]](https://github.com/apps/github-actions))

## [v0.15.0](https://github.com/ReliaQualAssociates/ramstk/tree/v0.15.0) (2022-01-07)

[Full Changelog](https://github.com/ReliaQualAssociates/ramstk/compare/v0.14.2...v0.15.0)

New Features

- release: v0.15.0 [\#840](https://github.com/ReliaQualAssociates/ramstk/pull/840) ([weibullguy](https://github.com/weibullguy))

**Merged pull requests:**

- ci: set for release [\#843](https://github.com/ReliaQualAssociates/ramstk/pull/843) ([github-actions[bot]](https://github.com/apps/github-actions))
Expand Down
46 changes: 26 additions & 20 deletions src/ramstk/configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
# pylint: disable=no-name-in-module
from distutils.errors import DistutilsFileError
from os import environ, makedirs
from typing import Any, Dict, List, Tuple
from typing import Any, Dict, Tuple, Union

# Third Party Imports
# noinspection PyPackageRequirements
Expand Down Expand Up @@ -525,32 +525,38 @@ def __init__(self) -> None:
self._logs_sub_dir = "/logs"

# Initialize public dictionary attributes.
self.RAMSTK_ACTION_CATEGORY: Dict[str, Tuple[str, str, str, str]] = {}
self.RAMSTK_ACTION_STATUS: Dict[str, Tuple[str, str, str]] = {}
self.RAMSTK_AFFINITY_GROUPS: Dict[str, Tuple[str, str]] = {} # User.
self.RAMSTK_CATEGORIES: Dict[str, str] = {} # Static.
self.RAMSTK_DAMAGE_MODELS: Dict[str, str] = {} # User.
self.RAMSTK_DETECTION_METHODS: Dict[str, Tuple[str, str, str]] = {}
self.RAMSTK_FAILURE_MODES: Dict[str, str] = {} # User.
self.RAMSTK_HAZARDS: Dict[str, Tuple[str, str]] = {} # User.
self.RAMSTK_INCIDENT_CATEGORY: Dict[str, Tuple[str, str, str, str]] = {}
self.RAMSTK_INCIDENT_STATUS: Dict[str, Tuple[str, str, str]] = {}
self.RAMSTK_INCIDENT_TYPE: Dict[str, Tuple[str, str, str]] = {}
self.RAMSTK_ACTION_CATEGORY: Dict[int, Tuple[str, str, str, str]] = {}
self.RAMSTK_ACTION_STATUS: Dict[int, Tuple[str, str, str]] = {}
self.RAMSTK_AFFINITY_GROUPS: Dict[int, Tuple[str, str]] = {} # User.
self.RAMSTK_CATEGORIES: Dict[int, str] = {} # Static.
self.RAMSTK_DAMAGE_MODELS: Dict[int, str] = {} # User.
self.RAMSTK_DETECTION_METHODS: Dict[int, Tuple[str, str, str]] = {}
self.RAMSTK_FAILURE_MODES: Dict[
int, Dict[int, Dict[int, Union[float, str]]]
] = {}
# User.
self.RAMSTK_HAZARDS: Dict[int, Tuple[str, str]] = {} # User.
self.RAMSTK_INCIDENT_CATEGORY: Dict[int, Tuple[str, str, str, str]] = {}
self.RAMSTK_INCIDENT_STATUS: Dict[int, Tuple[str, str, str]] = {}
self.RAMSTK_INCIDENT_TYPE: Dict[int, Tuple[str, str, str]] = {}
self.RAMSTK_LOAD_HISTORY: Dict[int, str] = {} # User.
self.RAMSTK_MANUFACTURERS: Dict[str, Tuple[str, str, str]] = {} # User.
self.RAMSTK_MANUFACTURERS: Dict[int, Tuple[str, str, str]] = {} # User.
self.RAMSTK_MEASURABLE_PARAMETERS: Dict[int, Tuple[str, str, str]] = {} # User.
self.RAMSTK_MEASUREMENT_UNITS: Dict[str, Tuple[str, str, str]] = {} # Admin.
self.RAMSTK_MEASUREMENT_UNITS: Dict[int, Tuple[str, str, str]] = {} # Admin.
self.RAMSTK_MODULES: Dict[str, str] = {} # Static.
self.RAMSTK_REQUIREMENT_TYPE: Dict[str, Tuple[str, str, str]] = {}
self.RAMSTK_REQUIREMENT_TYPE: Dict[int, Tuple[str, str, str]] = {}
self.RAMSTK_RPN_DETECTION: Dict[int, str] = {} # User.
self.RAMSTK_RPN_OCCURRENCE: Dict[int, str] = {} # User.
self.RAMSTK_RPN_SEVERITY: Dict[int, str] = {} # User.
self.RAMSTK_SEVERITY: Dict[str, Tuple[str, str, str, str]] = {} # Admin
self.RAMSTK_STAKEHOLDERS: Dict[str, str] = {} # User.
self.RAMSTK_STRESS_LIMITS: Dict[int, List[float]] = {} # User.
self.RAMSTK_SUBCATEGORIES: Dict[str, Dict[str, str]] = {} # Static.
self.RAMSTK_USERS: Dict[str, Tuple[str, str, str, str, str]] = {} # Admin.
self.RAMSTK_VALIDATION_TYPE: Dict[str, Tuple[str, str, str]] = {} # Admin.
self.RAMSTK_STAKEHOLDERS: Dict[int, str] = {} # User.
self.RAMSTK_STRESS_LIMITS: Dict[
int,
Tuple[float, float, float, float, float, float, float, float, float, float],
] = {} # User.
self.RAMSTK_SUBCATEGORIES: Dict[int, Dict[str, str]] = {} # Static.
self.RAMSTK_USERS: Dict[int, Tuple[str, str, str, str, str]] = {} # Admin.
self.RAMSTK_VALIDATION_TYPE: Dict[int, Tuple[str, str, str]] = {} # Admin.

self.RAMSTK_COLORS: Dict[str, str] = {}
self.RAMSTK_FORMAT_FILE: Dict[str, str] = {}
Expand Down
8 changes: 5 additions & 3 deletions src/ramstk/configuration.pyi
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Standard Library Imports
import gettext
from typing import Any
from typing import Any, Dict, Tuple, Union

# RAMSTK Package Imports
from ramstk.utilities import dir_exists as dir_exists
Expand Down Expand Up @@ -53,7 +53,7 @@ class RAMSTKUserConfiguration:
RAMSTK_CATEGORIES: Any = ...
RAMSTK_DAMAGE_MODELS: Any = ...
RAMSTK_DETECTION_METHODS: Any = ...
RAMSTK_FAILURE_MODES: Any = ...
RAMSTK_FAILURE_MODES: Dict[int, Dict[int, Dict[int, Union[float, str]]]] = ...
RAMSTK_HAZARDS: Any = ...
RAMSTK_INCIDENT_CATEGORY: Any = ...
RAMSTK_INCIDENT_STATUS: Any = ...
Expand All @@ -69,7 +69,9 @@ class RAMSTKUserConfiguration:
RAMSTK_RPN_SEVERITY: Any = ...
RAMSTK_SEVERITY: Any = ...
RAMSTK_STAKEHOLDERS: Any = ...
RAMSTK_STRESS_LIMITS: Any = ...
RAMSTK_STRESS_LIMITS: Dict[
int, Tuple[float, float, float, float, float, float, float, float, float, float]
] = ...
RAMSTK_SUBCATEGORIES: Any = ...
RAMSTK_USERS: Any = ...
RAMSTK_VALIDATION_TYPE: Any = ...
Expand Down
2 changes: 2 additions & 0 deletions src/ramstk/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,14 @@

from .basemodel import RAMSTKBaseRecord, RAMSTKBaseTable, RAMSTKBaseView # isort:skip
from .commondb.category.record import RAMSTKCategoryRecord # isort:skip
from .commondb.failure_mode.record import RAMSTKFailureModeRecord # isort:skip
from .commondb.site_info.record import RAMSTKSiteInfoRecord # isort:skip
from .commondb.subcategory.record import RAMSTKSubCategoryRecord # isort:skip
from .commondb.category.table import RAMSTKCategoryTable # isort:skip

# RAMSTK Local Imports
from .commondb.database import RAMSTKCommonDB
from .commondb.failure_mode.table import RAMSTKFailureModeTable
from .commondb.site_info.table import RAMSTKSiteInfoTable
from .commondb.subcategory.table import RAMSTKSubCategoryTable
from .programdb.action.record import RAMSTKActionRecord
Expand Down
1 change: 0 additions & 1 deletion src/ramstk/models/commondb/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@

# RAMSTK Local Imports
from .ramstkcondition import RAMSTKCondition
from .ramstkfailuremode import RAMSTKFailureMode
from .ramstkgroup import RAMSTKGroup
from .ramstkhazards import RAMSTKHazards
from .ramstkloadhistory import RAMSTKLoadHistory
Expand Down
2 changes: 1 addition & 1 deletion src/ramstk/models/commondb/category/record.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ class RAMSTKCategoryRecord(RAMSTK_BASE, RAMSTKBaseRecord):
cascade="delete",
)
mode = relationship( # type: ignore
"RAMSTKFailureMode",
"RAMSTKFailureModeRecord",
back_populates="category",
cascade="delete",
)
Expand Down
Loading

0 comments on commit f5e3a88

Please sign in to comment.