Skip to content

Commit

Permalink
removed uses of isinstance with module objects
Browse files Browse the repository at this point in the history
  • Loading branch information
seanebum committed Apr 9, 2020
1 parent 2d0f265 commit 8875706
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions gillespy2/core/events.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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(
Expand Down Expand Up @@ -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. '
Expand Down

0 comments on commit 8875706

Please sign in to comment.