Refactoring: Python/SMT

This commit is contained in:
2026-04-10 14:30:46 +01:00
parent 6bddf4bf38
commit 554b34afcf
12 changed files with 20 additions and 87 deletions

View File

@@ -34,9 +34,9 @@ class ReactionSystemWithConcentrationsParam(ReactionSystem):
def add_bg_set_entity(self, e):
name = ""
def_max_conc = -1
if type(e) is tuple and len(e) == 2:
if isinstance(e, tuple) and len(e) == 2:
name, def_max_conc = e
elif type(e) is str:
elif isinstance(e, str):
name = e
print("\nWARNING: no maximal concentration level specified for:", e, "\n")
else:
@@ -80,18 +80,10 @@ class ReactionSystemWithConcentrationsParam(ReactionSystem):
def is_valid_entity_with_concentration(self, e):
"""Sanity check for entities with concentration"""
if type(e) is tuple:
if len(e) == 2 and type(e[1]) is int:
return True
if isinstance(e, (tuple, list)) and len(e) == 2 and isinstance(e[1], int):
return True
if type(e) is list:
if len(e) == 2 and type(e[1]) is int:
return True
print("FATAL. Invalid entity+concentration: {:s}".format(e))
exit(1)
return False
raise RuntimeError("Invalid entity+concentration: " + repr(e))
def is_valid_concentration_for_entity(self, entity, level):
"""Checks the concentration level for entity"""