Skip to content

Commit

Permalink
make switch_model_context async; update versions
Browse files Browse the repository at this point in the history
  • Loading branch information
aleneum committed Oct 13, 2020
1 parent 163d959 commit ac4421a
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 5 deletions.
4 changes: 4 additions & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## 0.8.5 ()

- `AsyncMachine.switch_model_context` is expected to be `async` now for easier integration of async code during model switch.

## 0.8.4 (October 2020)

Release 0.8.4 is a minor release and contains bugfixes as well as new features:
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# <a name="transitions-module"></a> transitions
[![Version](https://img.shields.io/badge/version-v0.8.4-orange.svg)](https://github.com/pytransitions/transitions)
[![Version](https://img.shields.io/badge/version-v0.8.5-orange.svg)](https://github.com/pytransitions/transitions)
[![Build Status](https://travis-ci.org/pytransitions/transitions.svg?branch=master)](https://travis-ci.org/pytransitions/transitions)
[![Coverage Status](https://coveralls.io/repos/pytransitions/transitions/badge.svg?branch=master&service=github)](https://coveralls.io/github/pytransitions/transitions?branch=master)
[![PyPi](https://img.shields.io/pypi/v/transitions.svg)](https://pypi.org/project/transitions)
[![GitHub commits](https://img.shields.io/github/commits-since/pytransitions/transitions/0.8.3.svg)](https://github.com/pytransitions/transitions/compare/0.8.3...master)
[![GitHub commits](https://img.shields.io/github/commits-since/pytransitions/transitions/0.8.4.svg)](https://github.com/pytransitions/transitions/compare/0.8.4...master)
[![License](https://img.shields.io/github/license/pytransitions/transitions.svg)](LICENSE)
[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/pytransitions/transitions/master?filepath=examples%2FPlayground.ipynb)
<!-- [![Pylint](https://img.shields.io/badge/pylint-9.71%2F10-green.svg)](https://github.com/pytransitions/transitions) -->
Expand Down
4 changes: 2 additions & 2 deletions transitions/extensions/asyncio.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ async def execute(self, event_data):

machine = event_data.machine
# cancel running tasks since the transition will happen
machine.switch_model_context(event_data.model)
await machine.switch_model_context(event_data.model)

await event_data.machine.callbacks(event_data.machine.before_state_change, event_data)
await event_data.machine.callbacks(self.before, event_data)
Expand Down Expand Up @@ -352,7 +352,7 @@ async def await_all(callables):
"""
return await asyncio.gather(*[func() for func in callables])

def switch_model_context(self, model):
async def switch_model_context(self, model):
"""
This method is called by an `AsyncTransition` when all conditional tests have passed and the transition will happen.
This requires already running tasks to be cancelled.
Expand Down
2 changes: 1 addition & 1 deletion transitions/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
to determine transitions's version during runtime.
"""

__version__ = '0.8.4'
__version__ = '0.8.5'

0 comments on commit ac4421a

Please sign in to comment.