Skip to content

Commit

Permalink
adding support for non-static methods as catch handlers for the Facto…
Browse files Browse the repository at this point in the history
…ry class
  • Loading branch information
aleph2c committed Jul 30, 2019
1 parent a8b1f80 commit c39072d
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 7 deletions.
7 changes: 6 additions & 1 deletion miros/hsm.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# -*- coding: utf-8 -*-
import re
import sys
import pprint
import inspect
import traceback # try not use this if you can avoid it (it's fragile)
from copy import copy
from functools import wraps
Expand Down Expand Up @@ -213,7 +215,10 @@ def state_method_template(name):

def base_state_method(chart, e):
with chart.signal_callback(e, name) as fn:
status = fn(chart, e)
if not inspect.ismethod(fn):
status = fn(chart, e)
else:
status = fn(e)

if(status == return_status.UNHANDLED):
with chart.parent_callback(name) as parent:
Expand Down
11 changes: 9 additions & 2 deletions plan/release_notes.wiki
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
Allowing stop to be called within ActiveObject or Factory
Allow simple methods to be registered using the ``catch`` method in the Factory
class.

* the stop method can now be called within an ActiveObject or a Factory.
The Factory class lets a miros user build state machines within a class. Previous
to this release only static methods could be registered to signals during the
state construction process.

* static methods are still permitted as catch handler inputs (backwards
compatible)
* standard methods are now also permitted as catch handlers too.
7 changes: 4 additions & 3 deletions plan/release_plan.wiki
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
* I release so infrequently I can't remember how to do everything.
* I do not entirely understand the setup.py/pip infrastructure and their
documents are illegible. (fake it till you make it)
documents are mostly incomprehensible.
= Orient =

Expand All @@ -30,10 +30,11 @@
* [ ] Double check that your setup.py file is excluding all garbage (anything
not excluded will be put on a user's computer after a 'pip install miros')
* [ ] Re-run all tests
* [ ] Change release name in setup.py file
* [ ] Uprev release number in setup.py file
* [ ] Write your release notes
* [ ] Commit and push changes to github
* [ ] In the github release page, place your release notes
* [ ] In the github release page, place your release notes, tag using the release number
in setup.py file ex. v4.1.2
* [ ] Open cmd window
* [ ] Navigate to miros project
* [ ] > python setup.py sdist
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
py_modules=['miros'],

# https://packaging.python.org/en/latest/single_source_version.html
version='4.1.1',
version='4.1.2',

description='A statechart library for Python',
long_description=long_description,
Expand Down

0 comments on commit c39072d

Please sign in to comment.