From f5d5608fda5c39f398d559d7c78688843456615d Mon Sep 17 00:00:00 2001 From: imcovangent <I.vanGent@tudelft.nl> Date: Thu, 29 Mar 2018 17:52:10 +0200 Subject: [PATCH] Small bug fix in mode merge. Updated version strings to 0.8.0. Former-commit-id: eb918d185337e62407aa5fc2164cdfdd24a5f8fb --- kadmos/cmdows/cmdows.py | 2 +- kadmos/graph/graph_kadmos.py | 29 +++++++++++++++-------------- setup.py | 4 ++-- 3 files changed, 18 insertions(+), 17 deletions(-) diff --git a/kadmos/cmdows/cmdows.py b/kadmos/cmdows/cmdows.py index cb5208cef..fb846d58d 100644 --- a/kadmos/cmdows/cmdows.py +++ b/kadmos/cmdows/cmdows.py @@ -398,7 +398,7 @@ class CMDOWS(object): self.add_element_to_element_of_uid(dc_uid, outputs_element, 'designCompetence', 'outputs') return - def add_dc_general_info(self, dc_uid, description, dc_instance, status=None, creation_date=None, owner_uid=None, creator_uid=None, + def add_dc_general_info(self, dc_uid, description, status=None, creation_date=None, owner_uid=None, creator_uid=None, operator_uid=None, model_definition=None): """Method to add a general info element to a dc branch.""" # if instance is higher than 1 the metadata should not be added. diff --git a/kadmos/graph/graph_kadmos.py b/kadmos/graph/graph_kadmos.py index 6b9059667..5f76fbbbf 100644 --- a/kadmos/graph/graph_kadmos.py +++ b/kadmos/graph/graph_kadmos.py @@ -3439,9 +3439,8 @@ class KadmosGraph(nx.DiGraph, EquationMixin, VistomsMixin): """ # Handle the fact that the *args could also be a list or tuple directly - if len(args) == 2 and isinstance(args[0], basestring) and (isinstance(args[1], tuple) - or isinstance(args[1], list)): - args = [args[0]] + [arg for arg in args[1]] + if len(args) == 1 and isinstance(args[0], (tuple, list)): + args = args[0] # Input assertions assert len(args) > 1, 'At least two arguments are required for a function mode merge.' @@ -3449,24 +3448,26 @@ class KadmosGraph(nx.DiGraph, EquationMixin, VistomsMixin): assert isinstance(arg, basestring) # Create function-mode strings and check them function_nodes = list() - if 'suffices' in kwargs: - suffix_strs = kwargs['suffices'] + if 'ignore_function_id' in kwargs: + assert isinstance(kwargs['ignore_function_id'], bool), 'ignore_function_id should be of type Boolean.' + ignore_function_id = kwargs['ignore_function_id'] else: - suffix_strs = ['']*len(args) + ignore_function_id = False function_name_prev = None for idx, arg in enumerate(args): - node_name = arg + suffix_strs[idx] + node_name = arg function_name = self.nodes[node_name]['name'] function_nodes.append(node_name) self.assert_node_exists(node_name) self.assert_node_attribute_and_value(node_name, 'category', 'function') - if function_name_prev is not None: - assert function_name == function_name_prev, 'Nodes {} and {} do not have the same function ' \ - 'names.'.format(node_name, node_name_prev) - function_name_prev = function_name - node_name_prev = node_name - else: - function_name_prev = function_name + if not ignore_function_id: + if function_name_prev is not None: + assert function_name == function_name_prev, 'Nodes {} and {} do not have the same function ' \ + 'names.'.format(node_name, node_name_prev) + function_name_prev = function_name + node_name_prev = node_name + else: + function_name_prev = function_name # Check or create new node label if 'new_label' in kwargs: assert isinstance(kwargs['new_label'], basestring) diff --git a/setup.py b/setup.py index 5ac4d899b..419efcf28 100644 --- a/setup.py +++ b/setup.py @@ -1,7 +1,7 @@ from setuptools import setup, find_packages -version = '0.7.7' +version = '0.8.0' def readme(): @@ -11,7 +11,7 @@ def readme(): setup(name='kadmos', version=version, - description='Knowledge- and graph-based Agile Design with Multidisciplinary Optimization System', + description='Knowledge- and graph-based Agile Design for Multidisciplinary Optimization System', long_description=readme(), classifiers=[ 'Development Status :: 4 - Beta', -- GitLab