Skip to content

Commit a0315af

Browse files
Nikolaus C. Awtreynawtrey
authored andcommitted
MAINT: Simplify logic in KineticModel
* Removes redundant conditional statement in `KineticModel.__init__`
1 parent 48861e8 commit a0315af

File tree

1 file changed

+10
-11
lines changed

1 file changed

+10
-11
lines changed

kda/core.py

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -77,17 +77,16 @@ def __init__(self, K=None, G=None):
7777
RuntimeError
7878
If both ``K`` and ``G`` are ``None``.
7979
"""
80-
if G is None or K is None:
81-
if K is not None:
82-
# if only K is input create the diagram
83-
G = nx.MultiDiGraph()
84-
graph_utils.generate_edges(G=G, vals=K)
85-
elif G is not None:
86-
# if only G is input create the kinetic rate matrix
87-
K = graph_utils.retrieve_rate_matrix(G)
88-
else:
89-
msg = "To create a `KineticModel`, K or G must be input."
90-
raise RuntimeError(msg)
80+
if K is not None:
81+
# if only K is input create the diagram
82+
G = nx.MultiDiGraph()
83+
graph_utils.generate_edges(G=G, vals=K)
84+
elif G is not None:
85+
# if only G is input create the kinetic rate matrix
86+
K = graph_utils.retrieve_rate_matrix(G)
87+
else:
88+
msg = "To create a `KineticModel`, K or G must be input."
89+
raise RuntimeError(msg)
9190

9291
self.K = K
9392
self.G = G

0 commit comments

Comments
 (0)