Skip to content

Commit

Permalink
refactor: make ramstk_condition sub-package (#990)
Browse files Browse the repository at this point in the history
* refactor: move ramstk_condition to sub-package

* tests: update ramstk_condition tests

* style: add missing __init__.py to commondb packages
  • Loading branch information
weibullguy authored Feb 21, 2022
1 parent e630760 commit 668c814
Show file tree
Hide file tree
Showing 12 changed files with 548 additions and 78 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/on-pr-merge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ jobs:
- uses: actions/checkout@v2
- name: Build html documentation
run: |
sudo apt-get update
sudo apt-get install -y --no-install-recommends latexmk
cd docs
pip install -r requirements.txt
make html
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 @@ -14,12 +14,14 @@
)

from .commondb.category.record import RAMSTKCategoryRecord # isort:skip
from .commondb.condition.record import RAMSTKConditionRecord # 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.condition.table import RAMSTKConditionTable
from .commondb.database import RAMSTKCommonDB
from .commondb.failure_mode.table import RAMSTKFailureModeTable
from .commondb.site_info.table import RAMSTKSiteInfoTable
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 @@ -8,7 +8,6 @@
"""The RAMSTK common database models package."""

# RAMSTK Local Imports
from .ramstkcondition import RAMSTKCondition
from .ramstkgroup import RAMSTKGroup
from .ramstkhazards import RAMSTKHazards
from .ramstkloadhistory import RAMSTKLoadHistory
Expand Down
8 changes: 8 additions & 0 deletions src/ramstk/models/commondb/condition/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# pylint: disable=unused-import
# -*- coding: utf-8 -*-
#
# ramstk.models.commondb.condition.__init__.py is part of The RAMSTK Project
#
# All rights reserved.
# Copyright since 2007 Doyle "weibullguy" Rowland doyle.rowland <AT> reliaqual <DOT> com
"""The RAMSTK Condition model package."""
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# * coding: utf8 *
#
# ramstk.models.commondb.RAMSTKCondition.py is part of The RAMSTK Project
# ramstk.models.commondb.condition.record.py is part of The RAMSTK Project
#
# All rights reserved.
# Copyright 2007 2017 Doyle Rowland doyle.rowland <AT> reliaqual <DOT> com
"""RAMSTKCondition Table Module."""
# Copyright since 2007 Doyle "weibullguy" Rowland doyle.rowland <AT> reliaqual <DOT> com
"""Condition Record Model."""

# Third Party Imports
from sqlalchemy import Column, Integer, String
Expand All @@ -14,7 +14,7 @@
from ramstk.models import RAMSTKBaseRecord


class RAMSTKCondition(RAMSTK_BASE, RAMSTKBaseRecord):
class RAMSTKConditionRecord(RAMSTK_BASE, RAMSTKBaseRecord):
"""Class to represent ramstk_condition in RAMSTK Common database."""

__defaults__ = {
Expand Down Expand Up @@ -46,10 +46,8 @@ def get_attributes(self):
:return: {condition_id, description, condition_type} pairs
:rtype: dict
"""
_attributes = {
return {
"condition_id": self.condition_id,
"description": self.description,
"condition_type": self.condition_type,
}

return _attributes
57 changes: 57 additions & 0 deletions src/ramstk/models/commondb/condition/table.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# -*- coding: utf-8 -*-
#
# ramstk.models.commondb.condition.table.py is part of The RAMSTK Project
#
# All rights reserved.
# Copyright since 2007 Doyle "weibullguy" Rowland doyle.rowland <AT> reliaqual <DOT> com
"""Condition Table Model."""

# Standard Library Imports
from typing import Type

# RAMSTK Package Imports
from ramstk.models import RAMSTKBaseTable, RAMSTKConditionRecord


class RAMSTKConditionTable(RAMSTKBaseTable):
"""Contain the attributes and methods of the Option data manager."""

# Define private dict class attributes.

# Define private list class attributes.

# Define private scalar class attributes.
_db_id_colname = "fld_condition_id"
_db_tablename = "ramstk_condition"
_deprecated = False
_select_msg = "request_get_condition"
_tag = "condition"

# Define public dict class attributes.

# Define public list class attributes.

# Define public scalar class attributes.

def __init__(self, **kwargs) -> None:
"""Initialize a Options data manager instance."""
RAMSTKBaseTable.__init__(self, **kwargs)

# Initialize private dictionary attributes.

# Initialize private list attributes.
self._lst_id_columns = [
"condition_id",
]

# Initialize private scalar attributes.
self._record: Type[RAMSTKConditionRecord] = RAMSTKConditionRecord

# Initialize public dictionary attributes.

# Initialize public list attributes.

# Initialize public scalar attributes.
self.pkey = "condition_id"

# Subscribe to PyPubSub messages.
8 changes: 8 additions & 0 deletions src/ramstk/models/commondb/failure_mode/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# pylint: disable=unused-import
# -*- coding: utf-8 -*-
#
# ramstk.models.commondb.failure_mode.__init__.py is part of The RAMSTK Project
#
# All rights reserved.
# Copyright since 2007 Doyle "weibullguy" Rowland doyle.rowland <AT> reliaqual <DOT> com
"""The RAMSTK Failure Mode model package."""
8 changes: 8 additions & 0 deletions src/ramstk/models/commondb/subcategory/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# pylint: disable=unused-import
# -*- coding: utf-8 -*-
#
# ramstk.models.commondb.subcategory.__init__.py is part of The RAMSTK Project
#
# All rights reserved.
# Copyright since 2007 Doyle "weibullguy" Rowland doyle.rowland <AT> reliaqual <DOT> com
"""The RAMSTK SubCategory model package."""
Loading

0 comments on commit 668c814

Please sign in to comment.