From 887570677584ecb731967fbb75f7570c871f0382 Mon Sep 17 00:00:00 2001 From: seanebum Date: Thu, 9 Apr 2020 15:24:34 -0400 Subject: [PATCH] removed uses of isinstance with module objects --- gillespy2/core/events.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/gillespy2/core/events.py b/gillespy2/core/events.py index 673e79fc9..e58dd999e 100644 --- a/gillespy2/core/events.py +++ b/gillespy2/core/events.py @@ -135,7 +135,7 @@ def __init__(self, name="", delay = None, assignments = [], priority="0", 'name must be a valid string') # Trigger - if isinstance(trigger, EventTrigger): + if hasattr(trigger, 'expression'): self.trigger = trigger else: raise EventError( @@ -154,12 +154,12 @@ def __init__(self, name="", delay = None, assignments = [], priority="0", # Assignments if isinstance(assignments, list): for assign in assignments: - if isinstance(assign, EventAssignment): + if hasattr(assign, 'variable'): self.assignments.append(assign) else: raise EventError('assignment list contains an item ' 'is not an EventAssignment.') - elif isinstance(assignments, EventAssignment): + elif hasattr(assignments, 'variable'): self.assignments.append(assignments) else: raise EventError( @@ -190,11 +190,11 @@ def add_assignment(self, assignment): The event or list of events to be added to this event. """ - if isinstance(assignment, EventAssignment): + if hasattr(assignment, 'variable'): self.assignments.append(assignment) elif isinstance(assignment, list): for assign in assignment: - if isinstance(assign, EventAssignment): + if hasattr(assign, 'variable'): self.assignments.append(assign) else: raise EventError('add_assignment failed to add EventAssignment. '