Skip to content
Snippets Groups Projects
Commit 8cdc878c authored by imcovangent's avatar imcovangent
Browse files

Merge functions - updates - adjusted input assertions and interpretation.

Former-commit-id: 4408e23257b97b3f1d2b3fd43197080751202d4a
parent 8df77257
No related branches found
No related tags found
No related merge requests found
......@@ -1291,13 +1291,13 @@ class KadmosGraph(nx.DiGraph):
"""
 
# Handle the fact that the *args could also be a list or tuple directly
if len(args) == 1 and isinstance(args[0], tuple):
if len(args) == 1 and (isinstance(args[0], tuple) or isinstance(args[0], list)):
args = list(args[0])
 
# Input assertions
assert len(args) > 1
assert len(args) > 1, 'More than 1 input argument is required.'
for arg in args:
assert isinstance(arg, basestring)
assert isinstance(arg, basestring), 'Input arguments should be strings.'
 
# Get subgraph of functions and their (variable) neighbours
subgraph = self.get_subgraph_by_function_nodes(args)
......@@ -1348,13 +1348,13 @@ class KadmosGraph(nx.DiGraph):
"""
 
# Handle the fact that the *args could also be a list or tuple directly
if len(args) == 1 and isinstance(args[0], tuple):
if len(args) == 1 and (isinstance(args[0], tuple) or isinstance(args[0], list)):
args = list(args[0])
 
# Input assertions
assert len(args) > 1
assert len(args) > 1, 'More than 1 input is required for this function.'
for arg in args:
assert isinstance(arg, basestring)
assert isinstance(arg, basestring), 'Arguments should be strings.'
 
# Get subgraph of functions and their (variable) neighbours
subgraph = self.get_subgraph_by_function_nodes(args)
......@@ -1418,13 +1418,13 @@ class KadmosGraph(nx.DiGraph):
"""
 
# 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):
if len(args) == 2 and isinstance(args[0], basestring) and (isinstance(args[1], tuple) or isinstance(args[1], list)):
args = list(args[0]) + [arg for arg in args[1]]
 
# Input assertions
assert len(args) > 2, 'At least three arguments are required for a function mode merge.'
for arg in args:
assert isinstance(arg, basestring)
assert isinstance(arg, basestring), 'All arguments should be strings.'
# Create function-mode strings and check them
function_nodes = list()
for arg in args[1:]:
......@@ -2830,7 +2830,7 @@ class KadmosGraph(nx.DiGraph):
"""
# Input assertions
assert type(filename) is str
if filename[-7:] != '.kdms':
if filename[-5:] != '.kdms':
filename += '.kdms'
if destination_folder:
assert type(destination_folder) is str
......@@ -4174,7 +4174,7 @@ def open_kdms(filename, source_folder=None):
"""
# Input assertions
assert type(filename) is str, 'File name should be a string.'
if filename[-7:] != '.kdms':
if filename[-5:] != '.kdms':
filename += '.kdms'
if source_folder:
if source_folder[-1] == '/':
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment