Skip to content

Commit

Permalink
Minor changes (typo/text/doc)
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexandreDecan committed Aug 28, 2018
1 parent 8181177 commit a856721
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
6 changes: 3 additions & 3 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ The current time of an interpreter is now clock-based driven, thanks to the ``Cl

- (Added) A ``sismic.clock`` module with a ``Clock`` base class and three direct implementations,
namely ``SimulatedClock``, ``UtcClock`` and ``SynchronizedClock``. A ``SimulatedClock`` allows to manually or automatically
change the time, while a ``UtcClock`` as the expected behaviour of a wall-clock and a ``SynchronizedClock`` is a clock that synchronizes with another interpreter.
``Clock`` instances are used by the interpreter to get the current time during execution.
change the time, while a ``UtcClock`` as the expected behaviour of a wall-clock and a ``SynchronizedClock`` is a clock that
synchronizes with another interpreter. ``Clock`` instances are used by the interpreter to get the current time during execution.
See documentation for more information.
- (Added) An ``Interpreter.clock`` attribute that stores an instance of the newly added ``Clock`` class.
- (Changed) ``interpreter.time`` represents the time of the last executed step, not the current
Expand Down Expand Up @@ -71,7 +71,7 @@ And other small changes:
1.2.2 (2018-06-21)
------------------

- (Fixed) Event is not exposed when guard of eventless transitions are evaluated (regression
- (Fixed) Event shouldn't be exposed when guards of eventless transitions are evaluated (regression
introduced in version 1.2.1).
- (Changed) Improve performances when selecting transitions that could/will be triggered.

Expand Down
14 changes: 7 additions & 7 deletions sismic/interpreter/default.py
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ def execute_once(self) -> Optional[MacroStep]:
# Compute steps
computed_steps = self._compute_steps()

if computed_steps is None:
if len(computed_steps) == 0:
# No step (no transition, no event). However, check properties
self._check_properties(None)
return None
Expand Down Expand Up @@ -413,13 +413,13 @@ def _select_transitions(self, event: Optional[Event], states: Iterable[str], *,
# Group and sort transitions based on the event
eventless_first_order = lambda t: t.event is not None
for has_event, transitions in sorted_groupby(considered_transitions, key=eventless_first_order, reverse=not eventless_first):
# Event shouldn't be exposed to guards if we're processing eventless transition
exposed_event = event if has_event else None

# If there are selected transitions (from previous group), ignore new ones
if len(selected_transitions) > 0:
break

# Event shouldn't be exposed to guards if we're processing eventless transition
exposed_event = event if has_event else None

# Group and sort transitions based on the source state depth
depth_order = lambda t: _state_depth_cache[t.source]
for _, transitions in sorted_groupby(transitions, key=depth_order, reverse=inner_first):
Expand Down Expand Up @@ -500,12 +500,12 @@ def _sort_transitions(self, transitions: List[Transition]) -> List[Transition]:

return transitions

def _compute_steps(self) -> Optional[List[MicroStep]]:
def _compute_steps(self) -> List[MicroStep]:
"""
Compute and returns the next steps based on current configuration
and event queues.
:return A (possibly None) list of steps.
:return: a possibly empty list of steps
"""
# Initialization
if not self._initialized:
Expand All @@ -520,7 +520,7 @@ def _compute_steps(self) -> Optional[List[MicroStep]]:
if len(transitions) == 0:
if event is None:
# No event, no step!
return None
return []
else:
# Empty step, so that event is eventually consumed
return [MicroStep(event=event)]
Expand Down

0 comments on commit a856721

Please sign in to comment.