コード例 #1
0
ファイル: Model.py プロジェクト: diegohrey/ramstk
    def do_delete(self, node_id):
        """
        Remove a record from the RAMSTKFunction table.

        :param int node_id: the ID of the RAMSTKFunction record to be removed
                            from the RAMSTK Program database.
        :return: (_error_code, _msg); the error code and associated message.
        :rtype: (int, str)
        """
        _error_code, _msg = RAMSTKDataModel.do_delete(self, node_id)

        # pylint: disable=attribute-defined-outside-init
        # It is defined in RAMSTKDataModel.__init__
        if _error_code != 0:
            _error_code = 2005
            _msg = ("RAMSTK ERROR: Attempted to delete non-existent Function "
                    "ID {0:s}.").format(str(node_id))
        else:
            self.last_id = max(self.tree.nodes.keys())

            # If we're not running a test, let anyone who cares know a Function
            # was deleted.
            if not self._test:
                pub.sendMessage('deleted_function', tree=self.tree)

        return _error_code, _msg
コード例 #2
0
    def do_delete(self, node_id):
        """
        Remove a record from the RAMSTKTestMethod table.

        :param int node_id: the ID of the RAMSTKTestMethod record to be removed
                            from the RAMSTK Program database.
        :return: (_error_code, _msg); the error code and associated message.
        :rtype: (int, str)
        """
        _error_code, _msg = RAMSTKDataModel.do_delete(self, node_id)

        if _error_code != 0:
            _error_code = 2005
            _msg = _msg + '  RAMSTK ERROR: Attempted to delete non-existent ' \
                          'TestMethod ID {0:d}.'.format(node_id)

        return _error_code, _msg
コード例 #3
0
    def do_delete(self, node_id):
        """
        Remove record from the RAMSTKOpLoad, RAMSTKOpStress, or RAMSTKTestMethod table.

        :param int node_id: the ID of the RAMSTKMode record to be removed from the
                            RAMSTK Program database.
        :return: (_error_code, _msg); the error code and associated message.
        :rtype: (int, str)
        """
        _error_code, _msg = RAMSTKDataModel.do_delete(self, node_id)

        if _error_code != 0:
            _error_code = 2005
            _msg = _msg + '  RAMSTK ERROR: Attempted to delete non-existent ' \
                          'entity with Node ID {0:s} from the ' \
                          'Physics of Failure.'.format(node_id)

        return _error_code, _msg
コード例 #4
0
ファイル: Model.py プロジェクト: diegohrey/ramstk
    def do_delete(self, node_id):
        """
        Remove a record from the RAMSTKHazardAnalysis table.

        :param int node_id: the ID of the Hazard Analysis to be removed.
        :return: (_error_code, _msg); the error code and associated message.
        :rtype: (int, str)
        """
        _error_code, _msg = RAMSTKDataModel.do_delete(self, node_id)

        # pylint: disable=attribute-defined-outside-init
        # It is defined in RAMSTKDataModel.__init__
        if _error_code != 0:
            _error_code = 2005
            _msg = _msg + '  RAMSTK ERROR: Attempted to delete non-existent ' \
                          'Hazard Analysis ID {0:d}.'.format(node_id)
        else:
            self.last_id = max(self.tree.nodes.keys())

        return _error_code, _msg
コード例 #5
0
ファイル: Model.py プロジェクト: diegohrey/ramstk
    def do_delete(self, node_id):
        """
        Remove an entity from the Usage Profile and RAMSTK Program database.

        :param int node_id: the Node ID of the entity to be removed.
        :return: (_error_code, _msg); the error code and associated message.
        :rtype: (int, str)
        """
        _error_code, _msg = RAMSTKDataModel.do_delete(self, node_id)

        # pylint: disable=attribute-defined-outside-init
        # It is defined in RAMSTKDataModel.__init__
        if _error_code != 0:
            _error_code = 2005
            _msg = _msg + '  RAMSTK ERROR: Attempted to delete non-existent ' \
                          'Usage Profile entity with Node ID ' \
                          '{0:d}.'.format(node_id)
        else:
            self.last_id = max(self.tree.nodes.keys())

        return _error_code, _msg
コード例 #6
0
ファイル: Model.py プロジェクト: diegohrey/ramstk
    def do_delete(self, node_id):
        """
        Remove a record from the RAMSTKFailureDefinition table.

        :param int node_id: the PyPubSub Tree() ID of the Allocation to be
                            removed.
        :return: (_error_code, _msg); the error code and associated message.
        :rtype: (int, str)
        """
        _error_code, _msg = RAMSTKDataModel.do_delete(self, node_id)

        # pylint: disable=attribute-defined-outside-init
        # It is defined in RAMSTKDataModel.__init__
        if _error_code != 0:
            _error_code = 1
            _msg = _msg + (
                '\n  RAMSTK ERROR: Attempted to delete non-existent '
                'Allocation ID {0:d}.').format(node_id)
        else:
            self.last_id = max(self.tree.nodes.keys())

        return _error_code, _msg