cs.fsm


Namecs.fsm JSON
Version 20240721.1 PyPI version JSON
download
home_pageNone
SummaryBasic Finite State Machine (FSM) tools.
upload_time2024-07-21 04:02:27
maintainerNone
docs_urlNone
authorNone
requires_pythonNone
licenseGNU General Public License v3 or later (GPLv3+)
keywords python3
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            Basic Finite State Machine (FSM) tools.

*Latest release 20240721.1*:
FSM.fsm_print_state_diagram: bugfix: plumb fmt through to gvprint.

## Class `CancellationError(FSMError)`

Subclass of `FSMError` Raised when trying to make use of an
`FSM` which is cancelled.

For example, this is raised by a `cs.result.Result`
when accessing `.result` or `.exc_info` after cancellation.

*`CancellationError.__init__(self, message=None, *, fsm=None, **kw)`*:
Initialise the `CancellationError`.

The optional `message` parameter (default `"cancelled"`)
is set as the `message` attribute.
Other keyword parameters set their matching attributes.

## Class `FSM(cs.gvutils.DOTNodeMixin)`

Base class for a finite state machine (FSM).

The allowed states and transitions are defined by the class
attribute `FSM_TRANSITIONS`, a mapping of
*state*->*event*->*new_state*.

Each instance has the following attributes:
* `fsm_state`: the current state value.
* `fsm_history`: an optional iterable of `FSMTransitionEvent`
  state transitions recorded by the `fsm_event` method.
  Usually this would be `None` (the default) or a `list`.

<figure>
    <svg width="8pt" height="8pt"
   viewBox="0.00 0.00 8.00 8.00" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
  <g id="graph0" class="graph" transform="scale(1 1) rotate(0) translate(4 4)">
  <title>FSM State Diagram</title>
  <polygon fill="white" stroke="none" points="-4,4 -4,-4 4,-4 4,4 -4,4"/>
  </g>
  </svg>
  <figcaption>FSM State Diagram</figcaption>
</figure>


*`FSM.__init__(self, state=None, *, history=None, lock=None, transitions=None)`*:
Initialise the `FSM` from:
* `state`: optional _positional_ parameter for the initial state,
  default `self.FSM_DEFAULT_STATE` or the first key from `self.FSM_TRANSITIONS`
* `history`: an optional object to record state transition
  history, default `None`; if not `None` this should be an
  iterable object with a `.append(entry)` method such as a
  `list`.
* `lock`: an optional mutex to control access;
  if presupplied and shared with the caller
  it should probably be an `RLock`;
  the default is a `Lock`, which is enough for `FSM` private use
* `transitions`: optional *state*->*event*->*state* mapping;
  if provided, this will override the class `FSM_TRANSITIONS` mapping

Note that the `FSM` base class does not provide a
`FSM_DEFAULT_STATE` attribute; a default `state` value of
`None` will leave `.fsm_state` _unset_.

This behaviour is is chosen mostly to support subclasses
with unusual behaviour, particularly Django's `Model` class
whose `refresh_from_db` method seems to not refresh fields
which already exist, and setting `.fsm_state` from a
`FSM_DEFAULT_STATE` class attribute thus breaks this method.
Subclasses of this class and `Model` should _not_ provide a
`FSM_DEFAULT_STATE` attribute, instead relying on the field
definition to provide this default in the usual way.

*`FSM.__getattr__(self, attr)`*:
Provide the following attributes:
- present the state names as attributes, for example:
  `self.PENDING=='PENDING'` if there is a `'PENDING'` state
- present `is_`*statename* as a Boolean testing whether
  `self.fsm_state==`*statename*`.upper()`
- a callable calling `self.fsm_event(attr)` if `attr`
  is an event name for the current state
Fall back to the superclass `__getattr__`.

*`FSM.dot_node_palette_key`*:
Default palette index is `self.fsm_state`,
overriding `DOTNodeMixin.dot_node_palette_key`.

*`FSM.fsm_as_svg(self, layout=None, history_style=None, **dot_kw) -> str`*:
Render the state transition diagram as SVG.

*`FSM.fsm_callback(self, state, callback)`*:
Register a callback to be called immediately on transition
to `state` as `callback(self,FSMEventTransition)`.
The special `state` value `FSM.FSM_ANY_STATE` may be supplied
to register a callback which fires for every state transition.

    >>> fsm = FSM('state1',transitions={
    ...   'state1':{'ev_a':'state2'},
    ...   'state2':{'ev_b':'state1'},
    ... })
    >>> fsm.fsm_callback('state2',lambda task, transition: print(task, transition))
    >>> fsm.fsm_callback(FSM.FSM_ANY_STATE,lambda task, transition: print("ANY", task, transition))
    >>> fsm.ev_a(foo=3) # doctest: +ELLIPSIS
    ANY FSM:state2 FSMTransitionEvent(old_state='state1', new_state='state2', event='ev_a', when=..., extra={'foo': 3})
    FSM:state2 FSMTransitionEvent(old_state='state1', new_state='state2', event='ev_a', when=..., extra={'foo': 3})
    'state2'
    >>> fsm.ev_b(foo=4) # doctest: +ELLIPSIS
    ANY FSM:state1 FSMTransitionEvent(old_state='state2', new_state='state1', event='ev_b', when=..., extra={'foo': 4})
    'state1'

*`FSM.fsm_callback_discard(self, state, callback)`*:
Deregister a callback for `state`.

*`FSM.fsm_dot`*:
A DOT syntax description of the state diagram in the current state.

*`FSM.fsm_event(self, event, **extra)`*:
Transition the FSM from the current state to a new state based on `event`.
Call any callbacks associated with the new state.
Returns the new state.

Optional information may be passed as keyword arguments.

A `transition` instance of `FSMTransitionEvent` is created
with the following attributes:
* `old_state`: the state when `fsm_event` was called
* `new_state`: the new state
* `event`: the `event`
* `when`: a UNIX timestamp from `time.time()`
* `extra`: a `dict` with the `extra` information

If `self.fsm_history` is not `None`,
`transition` is appended to it.

If there are callbacks for `new_state` or `FSM.FSM_ANY_STATE`,
call each callback as `callback(self,transition)`.

*Important note*: the callbacks are run in series in the
current `Thread`.  If you need to dispatch a long running
activity from a state transtion, the callback should still
return promptly.

*`FSM.fsm_event_is_allowed(self, event)`*:
Test whether `event` is permitted in the current state.
This can be handy as a pretest.

*`FSM.fsm_events`*:
Return a list of the events valid for the current state.

*`FSM.fsm_history`*:
History property wrapping private attribute.
This aids subclassing where the history is not a local attribute.

*`FSM.fsm_print(self, file=None, fmt=None, layout=None, **dot_kw)`*:
Print the state transition diagram to `file`, default `sys.stdout`,
in format `fmt` using the engine specified by `layout`, default `'dot'`.
This is a wrapper for `cs.gvutils.gvprint`.

*`FSM.fsm_print_state_diagram(file=None, *, fmt=None, graph_name=None, history=None, history_style=None, state=None, transitions=None, **gvprint_kw)`*:
Print the state diagram via `cs.gvutils.gvprint`.

The DOT syntax graph description is computed with
`FSM.fsm_state_diagram_as_dot` and the `graph_name`,
`history`, `history_style`, `state` and `transitions`
parameters are passed through to this.

If `fmt` is specified as `dot` then the DOT and any remaining
keyword arguments are passed to `print()`.

Otherwise any remaining keyword paramaeters are passed to `gvprint`.

*`FSM.fsm_state_diagram_as_dot(transitions=None, *, sep='\n', state=None, graph_name=None, history=None, history_style=None) -> str`*:
Compute a DOT syntax graph description of the state diagram.

Parameters:
* `transitions`: optional mapping of *state*->*event*->*state*,
  default `cls.FSM_TRANSITIONS`
* `state`: optional current state name, a key of 
* `sep`: optional separator between "lines", default `'\n'`
* `graph_name`: optional name for the graph, default the class name
* `history`: optional event transition history
* `history_style`: optional style mapping for event transition history,
  used to style edges which have been traversed

*`FSM.fsm_svg`*:
The state transition diagram as SVG.

*`FSM.fsm_transitions_as_dot(self, transitions=None, **diagram_kw) -> str`*:
Compute a DOT syntax graph description of the state diagram.

Parameters:
* `transitions`: optional mapping of *state*->*event*->*state*,
  default `self.FSM_TRANSITIONS`
* `sep`: optional separator between "lines", default `'\n'`
* `graph_name`: optional name for the graph, default the class name
* `history_style`: optional style mapping for event transition history,
  used to style edges which have been traversed

## Class `FSMError(builtins.Exception)`

An exception associated with an `FSM`.

These have a `.fsm` attribute storing an (optional) `FSM`
reference supplied at initialisation.

## `FSMSubType = ~FSMSubType`

Type variable.

The preferred way to construct a type variable is via the dedicated
syntax for generic functions, classes, and type aliases::

    class Sequence[T]:  # T is a TypeVar
        ...

This syntax can also be used to create bound and constrained type
variables::

    # S is a TypeVar bound to str
    class StrSequence[S: str]:
        ...

    # A is a TypeVar constrained to str or bytes
    class StrOrBytesSequence[A: (str, bytes)]:
        ...

However, if desired, reusable type variables can also be constructed
manually, like so::

   T = TypeVar('T')  # Can be anything
   S = TypeVar('S', bound=str)  # Can be any subtype of str
   A = TypeVar('A', str, bytes)  # Must be exactly str or bytes

Type variables exist primarily for the benefit of static type
checkers.  They serve as the parameters for generic types as well
as for generic function and type alias definitions.

The variance of type variables is inferred by type checkers when they
are created through the type parameter syntax and when
``infer_variance=True`` is passed. Manually created type variables may
be explicitly marked covariant or contravariant by passing
``covariant=True`` or ``contravariant=True``. By default, manually
created type variables are invariant. See PEP 484 and PEP 695 for more
details.

## Class `FSMTransitionEvent(builtins.tuple)`

FSMTransitionEvent(old_state, new_state, event, when, extra)

*`FSMTransitionEvent.event`*:
Alias for field number 2

*`FSMTransitionEvent.extra`*:
Alias for field number 4

*`FSMTransitionEvent.new_state`*:
Alias for field number 1

*`FSMTransitionEvent.old_state`*:
Alias for field number 0

*`FSMTransitionEvent.when`*:
Alias for field number 3

# Release Log



*Release 20240721.1*:
FSM.fsm_print_state_diagram: bugfix: plumb fmt through to gvprint.

*Release 20240721*:
FSM: new fsm_print_state_diagram method to write the state diagram out in various formats.

*Release 20240712*:
FSM: make fsm_transitions_as_dot a shim for new fsm_state_diagram_as_dot class method.

*Release 20240630*:
* CancellationError from cs.result to cs.fsm, and use it to catch silently FSM event callbacks which raise it.
* Some other minor churn.

*Release 20240519*:
FSM: default for FSM_DEFAULT_STATE is the first key from FSM_TRANSITIONS (relies on ordered dicts, so Python 3.6 onward).

*Release 20240316*:
Fixed release upload artifacts.

*Release 20240305*:
FSM.__getattr__: return None for missing self.fsm_state, happens in too-early call to __str__.

*Release 20231020*:
FSM.__getattr__: known transition names no longerfall through to the superclass if not valid for the current state.

*Release 20231018*:
* FSM.fsm_transitions_as_dot: new optional history_style parameter to style transitioned edges.
* FSM.fsm_as_svg: plumb optional history_style parameter.

*Release 20230816.3*:
Bump cs.gvutils requirement.

*Release 20230816.2*:
FSM.fsm_transitions_as_dot: bugfix: the style needs "style=filled" as well as the fillcolor.

*Release 20230816.1*:
FSM.fsm_transitions_as_dot: now an instance method so that we can colour the current state.

*Release 20230816*:
FSM: new fsm_as_svg method and fsm_svg property.

*Release 20221118*:
* FSM.__init__: make state optional, default from self.FSM_DEFAULT_STATE - now all args are optional.
* FSM.__init__: if the state is None or not supplied, do not set .fsm_state at all; add explaination for this weird design choice.
* FSM.__getattr__: only generate event methods for events with public names (no leading underscore).
* FSM: new .fsm_history property, aiding subclassing elsewhere.
* FSM: drop dot_node_fillcolor, now provided by DOTNodeMixin.__getattr__, provide dot_node_palette_key using self.fsm_state.
* FSM.dot_node_attrs: color from self.dot_node_color.

*Release 20220918*:
Replace callback exception warning() with exception() for the traceback.

*Release 20220805.1*:
* FSM: subclass DOTNodeMixin and provide a hook for a colour palette for node fillcolors.
* Other minor changes.

*Release 20220805*:
Initial PyPI release.

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "cs.fsm",
    "maintainer": null,
    "docs_url": null,
    "requires_python": null,
    "maintainer_email": null,
    "keywords": "python3",
    "author": null,
    "author_email": "Cameron Simpson <cs@cskk.id.au>",
    "download_url": "https://files.pythonhosted.org/packages/23/62/b0ac61286c484f6718068e479a48c176c20eea7651013831884263a998df/cs_fsm-20240721.1.tar.gz",
    "platform": null,
    "description": "Basic Finite State Machine (FSM) tools.\n\n*Latest release 20240721.1*:\nFSM.fsm_print_state_diagram: bugfix: plumb fmt through to gvprint.\n\n## Class `CancellationError(FSMError)`\n\nSubclass of `FSMError` Raised when trying to make use of an\n`FSM` which is cancelled.\n\nFor example, this is raised by a `cs.result.Result`\nwhen accessing `.result` or `.exc_info` after cancellation.\n\n*`CancellationError.__init__(self, message=None, *, fsm=None, **kw)`*:\nInitialise the `CancellationError`.\n\nThe optional `message` parameter (default `\"cancelled\"`)\nis set as the `message` attribute.\nOther keyword parameters set their matching attributes.\n\n## Class `FSM(cs.gvutils.DOTNodeMixin)`\n\nBase class for a finite state machine (FSM).\n\nThe allowed states and transitions are defined by the class\nattribute `FSM_TRANSITIONS`, a mapping of\n*state*->*event*->*new_state*.\n\nEach instance has the following attributes:\n* `fsm_state`: the current state value.\n* `fsm_history`: an optional iterable of `FSMTransitionEvent`\n  state transitions recorded by the `fsm_event` method.\n  Usually this would be `None` (the default) or a `list`.\n\n<figure>\n    <svg width=\"8pt\" height=\"8pt\"\n   viewBox=\"0.00 0.00 8.00 8.00\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\">\n  <g id=\"graph0\" class=\"graph\" transform=\"scale(1 1) rotate(0) translate(4 4)\">\n  <title>FSM State Diagram</title>\n  <polygon fill=\"white\" stroke=\"none\" points=\"-4,4 -4,-4 4,-4 4,4 -4,4\"/>\n  </g>\n  </svg>\n  <figcaption>FSM State Diagram</figcaption>\n</figure>\n\n\n*`FSM.__init__(self, state=None, *, history=None, lock=None, transitions=None)`*:\nInitialise the `FSM` from:\n* `state`: optional _positional_ parameter for the initial state,\n  default `self.FSM_DEFAULT_STATE` or the first key from `self.FSM_TRANSITIONS`\n* `history`: an optional object to record state transition\n  history, default `None`; if not `None` this should be an\n  iterable object with a `.append(entry)` method such as a\n  `list`.\n* `lock`: an optional mutex to control access;\n  if presupplied and shared with the caller\n  it should probably be an `RLock`;\n  the default is a `Lock`, which is enough for `FSM` private use\n* `transitions`: optional *state*->*event*->*state* mapping;\n  if provided, this will override the class `FSM_TRANSITIONS` mapping\n\nNote that the `FSM` base class does not provide a\n`FSM_DEFAULT_STATE` attribute; a default `state` value of\n`None` will leave `.fsm_state` _unset_.\n\nThis behaviour is is chosen mostly to support subclasses\nwith unusual behaviour, particularly Django's `Model` class\nwhose `refresh_from_db` method seems to not refresh fields\nwhich already exist, and setting `.fsm_state` from a\n`FSM_DEFAULT_STATE` class attribute thus breaks this method.\nSubclasses of this class and `Model` should _not_ provide a\n`FSM_DEFAULT_STATE` attribute, instead relying on the field\ndefinition to provide this default in the usual way.\n\n*`FSM.__getattr__(self, attr)`*:\nProvide the following attributes:\n- present the state names as attributes, for example:\n  `self.PENDING=='PENDING'` if there is a `'PENDING'` state\n- present `is_`*statename* as a Boolean testing whether\n  `self.fsm_state==`*statename*`.upper()`\n- a callable calling `self.fsm_event(attr)` if `attr`\n  is an event name for the current state\nFall back to the superclass `__getattr__`.\n\n*`FSM.dot_node_palette_key`*:\nDefault palette index is `self.fsm_state`,\noverriding `DOTNodeMixin.dot_node_palette_key`.\n\n*`FSM.fsm_as_svg(self, layout=None, history_style=None, **dot_kw) -> str`*:\nRender the state transition diagram as SVG.\n\n*`FSM.fsm_callback(self, state, callback)`*:\nRegister a callback to be called immediately on transition\nto `state` as `callback(self,FSMEventTransition)`.\nThe special `state` value `FSM.FSM_ANY_STATE` may be supplied\nto register a callback which fires for every state transition.\n\n    >>> fsm = FSM('state1',transitions={\n    ...   'state1':{'ev_a':'state2'},\n    ...   'state2':{'ev_b':'state1'},\n    ... })\n    >>> fsm.fsm_callback('state2',lambda task, transition: print(task, transition))\n    >>> fsm.fsm_callback(FSM.FSM_ANY_STATE,lambda task, transition: print(\"ANY\", task, transition))\n    >>> fsm.ev_a(foo=3) # doctest: +ELLIPSIS\n    ANY FSM:state2 FSMTransitionEvent(old_state='state1', new_state='state2', event='ev_a', when=..., extra={'foo': 3})\n    FSM:state2 FSMTransitionEvent(old_state='state1', new_state='state2', event='ev_a', when=..., extra={'foo': 3})\n    'state2'\n    >>> fsm.ev_b(foo=4) # doctest: +ELLIPSIS\n    ANY FSM:state1 FSMTransitionEvent(old_state='state2', new_state='state1', event='ev_b', when=..., extra={'foo': 4})\n    'state1'\n\n*`FSM.fsm_callback_discard(self, state, callback)`*:\nDeregister a callback for `state`.\n\n*`FSM.fsm_dot`*:\nA DOT syntax description of the state diagram in the current state.\n\n*`FSM.fsm_event(self, event, **extra)`*:\nTransition the FSM from the current state to a new state based on `event`.\nCall any callbacks associated with the new state.\nReturns the new state.\n\nOptional information may be passed as keyword arguments.\n\nA `transition` instance of `FSMTransitionEvent` is created\nwith the following attributes:\n* `old_state`: the state when `fsm_event` was called\n* `new_state`: the new state\n* `event`: the `event`\n* `when`: a UNIX timestamp from `time.time()`\n* `extra`: a `dict` with the `extra` information\n\nIf `self.fsm_history` is not `None`,\n`transition` is appended to it.\n\nIf there are callbacks for `new_state` or `FSM.FSM_ANY_STATE`,\ncall each callback as `callback(self,transition)`.\n\n*Important note*: the callbacks are run in series in the\ncurrent `Thread`.  If you need to dispatch a long running\nactivity from a state transtion, the callback should still\nreturn promptly.\n\n*`FSM.fsm_event_is_allowed(self, event)`*:\nTest whether `event` is permitted in the current state.\nThis can be handy as a pretest.\n\n*`FSM.fsm_events`*:\nReturn a list of the events valid for the current state.\n\n*`FSM.fsm_history`*:\nHistory property wrapping private attribute.\nThis aids subclassing where the history is not a local attribute.\n\n*`FSM.fsm_print(self, file=None, fmt=None, layout=None, **dot_kw)`*:\nPrint the state transition diagram to `file`, default `sys.stdout`,\nin format `fmt` using the engine specified by `layout`, default `'dot'`.\nThis is a wrapper for `cs.gvutils.gvprint`.\n\n*`FSM.fsm_print_state_diagram(file=None, *, fmt=None, graph_name=None, history=None, history_style=None, state=None, transitions=None, **gvprint_kw)`*:\nPrint the state diagram via `cs.gvutils.gvprint`.\n\nThe DOT syntax graph description is computed with\n`FSM.fsm_state_diagram_as_dot` and the `graph_name`,\n`history`, `history_style`, `state` and `transitions`\nparameters are passed through to this.\n\nIf `fmt` is specified as `dot` then the DOT and any remaining\nkeyword arguments are passed to `print()`.\n\nOtherwise any remaining keyword paramaeters are passed to `gvprint`.\n\n*`FSM.fsm_state_diagram_as_dot(transitions=None, *, sep='\\n', state=None, graph_name=None, history=None, history_style=None) -> str`*:\nCompute a DOT syntax graph description of the state diagram.\n\nParameters:\n* `transitions`: optional mapping of *state*->*event*->*state*,\n  default `cls.FSM_TRANSITIONS`\n* `state`: optional current state name, a key of \n* `sep`: optional separator between \"lines\", default `'\\n'`\n* `graph_name`: optional name for the graph, default the class name\n* `history`: optional event transition history\n* `history_style`: optional style mapping for event transition history,\n  used to style edges which have been traversed\n\n*`FSM.fsm_svg`*:\nThe state transition diagram as SVG.\n\n*`FSM.fsm_transitions_as_dot(self, transitions=None, **diagram_kw) -> str`*:\nCompute a DOT syntax graph description of the state diagram.\n\nParameters:\n* `transitions`: optional mapping of *state*->*event*->*state*,\n  default `self.FSM_TRANSITIONS`\n* `sep`: optional separator between \"lines\", default `'\\n'`\n* `graph_name`: optional name for the graph, default the class name\n* `history_style`: optional style mapping for event transition history,\n  used to style edges which have been traversed\n\n## Class `FSMError(builtins.Exception)`\n\nAn exception associated with an `FSM`.\n\nThese have a `.fsm` attribute storing an (optional) `FSM`\nreference supplied at initialisation.\n\n## `FSMSubType = ~FSMSubType`\n\nType variable.\n\nThe preferred way to construct a type variable is via the dedicated\nsyntax for generic functions, classes, and type aliases::\n\n    class Sequence[T]:  # T is a TypeVar\n        ...\n\nThis syntax can also be used to create bound and constrained type\nvariables::\n\n    # S is a TypeVar bound to str\n    class StrSequence[S: str]:\n        ...\n\n    # A is a TypeVar constrained to str or bytes\n    class StrOrBytesSequence[A: (str, bytes)]:\n        ...\n\nHowever, if desired, reusable type variables can also be constructed\nmanually, like so::\n\n   T = TypeVar('T')  # Can be anything\n   S = TypeVar('S', bound=str)  # Can be any subtype of str\n   A = TypeVar('A', str, bytes)  # Must be exactly str or bytes\n\nType variables exist primarily for the benefit of static type\ncheckers.  They serve as the parameters for generic types as well\nas for generic function and type alias definitions.\n\nThe variance of type variables is inferred by type checkers when they\nare created through the type parameter syntax and when\n``infer_variance=True`` is passed. Manually created type variables may\nbe explicitly marked covariant or contravariant by passing\n``covariant=True`` or ``contravariant=True``. By default, manually\ncreated type variables are invariant. See PEP 484 and PEP 695 for more\ndetails.\n\n## Class `FSMTransitionEvent(builtins.tuple)`\n\nFSMTransitionEvent(old_state, new_state, event, when, extra)\n\n*`FSMTransitionEvent.event`*:\nAlias for field number 2\n\n*`FSMTransitionEvent.extra`*:\nAlias for field number 4\n\n*`FSMTransitionEvent.new_state`*:\nAlias for field number 1\n\n*`FSMTransitionEvent.old_state`*:\nAlias for field number 0\n\n*`FSMTransitionEvent.when`*:\nAlias for field number 3\n\n# Release Log\n\n\n\n*Release 20240721.1*:\nFSM.fsm_print_state_diagram: bugfix: plumb fmt through to gvprint.\n\n*Release 20240721*:\nFSM: new fsm_print_state_diagram method to write the state diagram out in various formats.\n\n*Release 20240712*:\nFSM: make fsm_transitions_as_dot a shim for new fsm_state_diagram_as_dot class method.\n\n*Release 20240630*:\n* CancellationError from cs.result to cs.fsm, and use it to catch silently FSM event callbacks which raise it.\n* Some other minor churn.\n\n*Release 20240519*:\nFSM: default for FSM_DEFAULT_STATE is the first key from FSM_TRANSITIONS (relies on ordered dicts, so Python 3.6 onward).\n\n*Release 20240316*:\nFixed release upload artifacts.\n\n*Release 20240305*:\nFSM.__getattr__: return None for missing self.fsm_state, happens in too-early call to __str__.\n\n*Release 20231020*:\nFSM.__getattr__: known transition names no longerfall through to the superclass if not valid for the current state.\n\n*Release 20231018*:\n* FSM.fsm_transitions_as_dot: new optional history_style parameter to style transitioned edges.\n* FSM.fsm_as_svg: plumb optional history_style parameter.\n\n*Release 20230816.3*:\nBump cs.gvutils requirement.\n\n*Release 20230816.2*:\nFSM.fsm_transitions_as_dot: bugfix: the style needs \"style=filled\" as well as the fillcolor.\n\n*Release 20230816.1*:\nFSM.fsm_transitions_as_dot: now an instance method so that we can colour the current state.\n\n*Release 20230816*:\nFSM: new fsm_as_svg method and fsm_svg property.\n\n*Release 20221118*:\n* FSM.__init__: make state optional, default from self.FSM_DEFAULT_STATE - now all args are optional.\n* FSM.__init__: if the state is None or not supplied, do not set .fsm_state at all; add explaination for this weird design choice.\n* FSM.__getattr__: only generate event methods for events with public names (no leading underscore).\n* FSM: new .fsm_history property, aiding subclassing elsewhere.\n* FSM: drop dot_node_fillcolor, now provided by DOTNodeMixin.__getattr__, provide dot_node_palette_key using self.fsm_state.\n* FSM.dot_node_attrs: color from self.dot_node_color.\n\n*Release 20220918*:\nReplace callback exception warning() with exception() for the traceback.\n\n*Release 20220805.1*:\n* FSM: subclass DOTNodeMixin and provide a hook for a colour palette for node fillcolors.\n* Other minor changes.\n\n*Release 20220805*:\nInitial PyPI release.\n",
    "bugtrack_url": null,
    "license": "GNU General Public License v3 or later (GPLv3+)",
    "summary": "Basic Finite State Machine (FSM) tools.",
    "version": "20240721.1",
    "project_urls": {
        "MonoRepo Commits": "https://bitbucket.org/cameron_simpson/css/commits/branch/main",
        "Monorepo Git Mirror": "https://github.com/cameron-simpson/css",
        "Monorepo Hg/Mercurial Mirror": "https://hg.sr.ht/~cameron-simpson/css",
        "Source": "https://github.com/cameron-simpson/css/blob/main/lib/python/cs/fsm.py"
    },
    "split_keywords": [
        "python3"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "ed6edffedcd549fbba5ff5ca69076bb2c84b37790cb3a15ac552765bcd331821",
                "md5": "18fe616e615ed364de6927d5d8edea30",
                "sha256": "d0bfc877f0beb047f052b12c45e3d2abb559989065b2cc2ca76ca98041d6ad91"
            },
            "downloads": -1,
            "filename": "cs.fsm-20240721.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "18fe616e615ed364de6927d5d8edea30",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 11145,
            "upload_time": "2024-07-21T04:02:25",
            "upload_time_iso_8601": "2024-07-21T04:02:25.667511Z",
            "url": "https://files.pythonhosted.org/packages/ed/6e/dffedcd549fbba5ff5ca69076bb2c84b37790cb3a15ac552765bcd331821/cs.fsm-20240721.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "2362b0ac61286c484f6718068e479a48c176c20eea7651013831884263a998df",
                "md5": "ac8347477a571f5856f01cbbea734558",
                "sha256": "f7f02a41dc188c75acefeb0a84891e5dc4b1862c111bbdb65f78866a10c9137d"
            },
            "downloads": -1,
            "filename": "cs_fsm-20240721.1.tar.gz",
            "has_sig": false,
            "md5_digest": "ac8347477a571f5856f01cbbea734558",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 12575,
            "upload_time": "2024-07-21T04:02:27",
            "upload_time_iso_8601": "2024-07-21T04:02:27.981836Z",
            "url": "https://files.pythonhosted.org/packages/23/62/b0ac61286c484f6718068e479a48c176c20eea7651013831884263a998df/cs_fsm-20240721.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-07-21 04:02:27",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "cameron-simpson",
    "github_project": "css",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "cs.fsm"
}
        
Elapsed time: 1.06937s