python-statemachine 3.1.1__py3-none-any.whl → 3.1.2__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: python-statemachine
3
- Version: 3.1.1
3
+ Version: 3.1.2
4
4
  Summary: Python Finite State Machines made easy.
5
5
  Project-URL: homepage, https://github.com/fgmacedo/python-statemachine
6
6
  Author-email: Fernando Macedo <fgmacedo@gmail.com>
@@ -1,4 +1,4 @@
1
- statemachine/__init__.py,sha256=6QmaIOvUXefWn7Ur1IFrqnM8ehtcwtnPrvRE44ELq4w,445
1
+ statemachine/__init__.py,sha256=yQtTMGmdCawa7KJruju803HXI20v6IWtKibPQ61tL6o,445
2
2
  statemachine/callbacks.py,sha256=mY_RAl86240vG2C94ij6AdD7CgsIM8mr0wvpSAMAPv0,14644
3
3
  statemachine/configuration.py,sha256=5tTx4-_cXnu6apxdvUfhfhDe6zym9BJynqQ-lrIxnls,6018
4
4
  statemachine/dispatcher.py,sha256=xvA1Kf1xGQivHTpaGm_HC22vqAmE_tTm9LQwyVLRWLE,7841
@@ -6,7 +6,7 @@ statemachine/event.py,sha256=d_Ky5ph30Os305BceN4x-rftZH-h8G1U5ei34-66lnI,7669
6
6
  statemachine/event_data.py,sha256=7_hoE0cp-0uW71Kk3erO3eYM6anTT5X3slGMcehIGIo,3111
7
7
  statemachine/events.py,sha256=11GyX8GYpsSwvW0v1b4zHUGhzKRoqNjQYtuDj8NvqOM,1212
8
8
  statemachine/exceptions.py,sha256=gXFvDsEtIxKdcGrRG9mwDgXqFQDXfw8v66_VXaQgGr4,1305
9
- statemachine/factory.py,sha256=HQc2Hn1irg96Rkygn2E21YAxFV5PRYiXYh4tTKVWBbc,14706
9
+ statemachine/factory.py,sha256=9uujdEe7UV0QG7ZpmRfLwqvrbrbmyzkL3afww3CVufQ,14744
10
10
  statemachine/graph.py,sha256=r-8L7jXab1_VLtVu-Ig8bpe4Szo-r6WDFTdbfcepyZM,1981
11
11
  statemachine/i18n.py,sha256=NLvGseaORmQ0G-V_J8tkjoxh_piWMOm2CI6mBQpLamc,362
12
12
  statemachine/invoke.py,sha256=ydYBzP5pi67r9GYmDd6fT169MZkLM4lgpYcbuSyX3Ok,24874
@@ -27,7 +27,7 @@ statemachine/utils.py,sha256=taCgrsRDcQQLweyq607AVZyI0NMukRP-HGpO8TiVNgk,1527
27
27
  statemachine/contrib/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
28
28
  statemachine/contrib/timeout.py,sha256=VXkdLpxNeUKihkbtLv8XTWdG-meQlSFtxJfcxXgV8Uw,2251
29
29
  statemachine/contrib/weighted.py,sha256=jcKkm25df6NnzBzuss1-ewDEasZ_CyME03xgJXrwcso,6866
30
- statemachine/contrib/diagram/__init__.py,sha256=NaVy7LWly8fTJNxjaXoRlWdYQ7cwbuNQPN0BMW6ATrI,7532
30
+ statemachine/contrib/diagram/__init__.py,sha256=mvTluFDnhE2OzTeOhyU7aQebl79LIOsvOiNFAVIldww,7730
31
31
  statemachine/contrib/diagram/__main__.py,sha256=iPpiz09xKqtAjrhONS99OYp6R2dQ6Anbhw1qPIN8ELo,80
32
32
  statemachine/contrib/diagram/extract.py,sha256=RmjsTpOkbQxwYS_m5BS1VWisef5vHtTRmmwe_Dq3wMk,9891
33
33
  statemachine/contrib/diagram/formatter.py,sha256=SeNKdt5jzKIDNUPHD0xZQ0cb_zsQbwrucoZtMVXL0og,4758
@@ -48,11 +48,11 @@ statemachine/io/scxml/invoke.py,sha256=raRStlMBOfxto6KIkCbi3jJ3UQ3QfuT0ezn4B48A6
48
48
  statemachine/io/scxml/parser.py,sha256=zggZwu0rHZNWDaJTHD2XC3MrCy_bi4CNHStfWE9NHgU,16582
49
49
  statemachine/io/scxml/processor.py,sha256=_hjW4VTuzbPK2q5a7dp2kYMBcbRBZFbjz-wJKSZLI8I,9467
50
50
  statemachine/io/scxml/schema.py,sha256=xNpW_nkS2Z_hye5p1WLr8VhuM85Nic2HqRLCnoFN3ss,3927
51
- statemachine/locale/en/LC_MESSAGES/statemachine.po,sha256=MZpydlIX__YjJZw2-zBEVNjuUqLEt6AYYWfrq8Rff90,5338
52
- statemachine/locale/hi_IN/LC_MESSAGES/statemachine.po,sha256=LLaDkTU0GZaataEWl35ap1SDgsJkdEr-0_u8gg5q7kI,7948
53
- statemachine/locale/pt_BR/LC_MESSAGES/statemachine.po,sha256=z-phNrS8soB26B67yz3f6eYB-KpcXX0MZEBWJqsztgg,5814
54
- statemachine/locale/zh_CN/LC_MESSAGES/statemachine.po,sha256=nxhwoPj23VjI_4O3r3hKjoc3H5rGox7gbdY-wzWFm6A,5369
55
- python_statemachine-3.1.1.dist-info/METADATA,sha256=EdRvT7EegYFkRrnnT5PR6yPD4oksBzb9112dPFO1a4w,12249
56
- python_statemachine-3.1.1.dist-info/WHEEL,sha256=QccIxa26bgl1E6uMy58deGWi-0aeIkkangHcxk2kWfw,87
57
- python_statemachine-3.1.1.dist-info/licenses/LICENSE,sha256=zcP7TsJMqaFxuTvLRZPT7nJl3_ppjxR9Z76BE9pL5zc,1074
58
- python_statemachine-3.1.1.dist-info/RECORD,,
51
+ statemachine/locale/en/LC_MESSAGES/statemachine.po,sha256=j86vdOgdbE3vBA99RNil5JcMT7oCnyLrFBJYpLq5AxU,5338
52
+ statemachine/locale/hi_IN/LC_MESSAGES/statemachine.po,sha256=iyDoGxxhvmOPdbNH6lSa2CnjuPC4cJ6wOuLhIKsXBDs,7948
53
+ statemachine/locale/pt_BR/LC_MESSAGES/statemachine.po,sha256=Sm4RJe_NqBjGj1VGLOVQthW5-CBJbXhz0zbc5833Yq8,5814
54
+ statemachine/locale/zh_CN/LC_MESSAGES/statemachine.po,sha256=y4D_bbD-bbgrkvwZuTPl6f1fGAx-panT-xiTlMZlxuQ,5363
55
+ python_statemachine-3.1.2.dist-info/METADATA,sha256=k0pgPqHbJJtUT6oLMPjrf4zFzFwfEzzfqWFFTGkcp_s,12249
56
+ python_statemachine-3.1.2.dist-info/WHEEL,sha256=QccIxa26bgl1E6uMy58deGWi-0aeIkkangHcxk2kWfw,87
57
+ python_statemachine-3.1.2.dist-info/licenses/LICENSE,sha256=zcP7TsJMqaFxuTvLRZPT7nJl3_ppjxR9Z76BE9pL5zc,1074
58
+ python_statemachine-3.1.2.dist-info/RECORD,,
statemachine/__init__.py CHANGED
@@ -8,7 +8,7 @@ from .statemachine import TModel
8
8
 
9
9
  __author__ = """Fernando Macedo"""
10
10
  __email__ = "fgmacedo@gmail.com"
11
- __version__ = "3.1.1"
11
+ __version__ = "3.1.2"
12
12
 
13
13
  __all__ = [
14
14
  "StateChart",
@@ -1,13 +1,14 @@
1
1
  import importlib
2
+ from typing import TYPE_CHECKING
2
3
  from urllib.parse import quote
3
4
  from urllib.request import urlopen
4
5
 
5
6
  from .extract import extract
6
7
  from .formatter import formatter as formatter
7
- from .renderers.dot import DotRenderer
8
- from .renderers.dot import DotRendererConfig
9
- from .renderers.mermaid import MermaidRenderer
10
- from .renderers.mermaid import MermaidRendererConfig
8
+
9
+ if TYPE_CHECKING:
10
+ from .renderers.dot import DotRendererConfig
11
+ from .renderers.mermaid import MermaidRendererConfig
11
12
 
12
13
 
13
14
  class DotGraphMachine:
@@ -40,7 +41,9 @@ class DotGraphMachine:
40
41
  def __init__(self, machine):
41
42
  self.machine = machine
42
43
 
43
- def _build_config(self) -> DotRendererConfig:
44
+ def _build_config(self) -> "DotRendererConfig":
45
+ from .renderers.dot import DotRendererConfig
46
+
44
47
  return DotRendererConfig(
45
48
  graph_rankdir=self.graph_rankdir,
46
49
  font_name=self.font_name,
@@ -51,6 +54,8 @@ class DotGraphMachine:
51
54
  )
52
55
 
53
56
  def get_graph(self):
57
+ from .renderers.dot import DotRenderer
58
+
54
59
  ir = extract(self.machine)
55
60
  renderer = DotRenderer(config=self._build_config())
56
61
  return renderer.render(ir)
@@ -69,7 +74,9 @@ class MermaidGraphMachine:
69
74
  def __init__(self, machine):
70
75
  self.machine = machine
71
76
 
72
- def _build_config(self) -> MermaidRendererConfig:
77
+ def _build_config(self) -> "MermaidRendererConfig":
78
+ from .renderers.mermaid import MermaidRendererConfig
79
+
73
80
  return MermaidRendererConfig(
74
81
  direction=self.direction,
75
82
  active_fill=self.active_fill,
@@ -77,6 +84,8 @@ class MermaidGraphMachine:
77
84
  )
78
85
 
79
86
  def get_mermaid(self) -> str:
87
+ from .renderers.mermaid import MermaidRenderer
88
+
80
89
  ir = extract(self.machine)
81
90
  renderer = MermaidRenderer(config=self._build_config())
82
91
  return renderer.render(ir)
statemachine/factory.py CHANGED
@@ -99,7 +99,7 @@ class StateMachineMetaclass(type):
99
99
  def _expand_docstring(cls) -> None:
100
100
  """Replace ``{statechart:FORMAT}`` placeholders in the class docstring."""
101
101
  doc = cls.__doc__
102
- if not doc:
102
+ if not doc or not cls._STATECHART_RE.search(doc):
103
103
  return
104
104
 
105
105
  from .contrib.diagram.formatter import formatter
@@ -5,7 +5,7 @@ msgid ""
5
5
  msgstr ""
6
6
  "Project-Id-Version: 3.1.1\n"
7
7
  "Report-Msgid-Bugs-To: fgmacedo@gmail.com\n"
8
- "POT-Creation-Date: 2026-05-15 12:08-0300\n"
8
+ "POT-Creation-Date: 2026-05-18 16:16-0300\n"
9
9
  "PO-Revision-Date: 2026-02-24 14:31-0300\n"
10
10
  "Last-Translator: Fernando Macedo <fgmacedo@gmail.com>\n"
11
11
  "Language: en\n"
@@ -21,7 +21,7 @@ msgstr ""
21
21
  msgid "Did not found name '{}' from model or statemachine"
22
22
  msgstr "Did not found name '{}' from model or statemachine"
23
23
 
24
- #: statemachine/configuration.py:121
24
+ #: statemachine/configuration.py:129
25
25
  msgid ""
26
26
  "There's no current state set. In async code, did you activate the initial"
27
27
  " state? (e.g., `await sm.activate_initial_state()`)"
@@ -5,7 +5,7 @@ msgid ""
5
5
  msgstr ""
6
6
  "Project-Id-Version: 3.1.1\n"
7
7
  "Report-Msgid-Bugs-To: fgmacedo@gmail.com\n"
8
- "POT-Creation-Date: 2026-05-15 12:08-0300\n"
8
+ "POT-Creation-Date: 2026-05-18 16:16-0300\n"
9
9
  "PO-Revision-Date: 2024-06-07 17:41-0300\n"
10
10
  "Last-Translator: Fernando Macedo <fgmacedo@gmail.com>\n"
11
11
  "Language: hi_IN\n"
@@ -21,7 +21,7 @@ msgstr ""
21
21
  msgid "Did not found name '{}' from model or statemachine"
22
22
  msgstr "मॉडल या स्टेटमशीन में नाम '{}' नहीं मिला"
23
23
 
24
- #: statemachine/configuration.py:121
24
+ #: statemachine/configuration.py:129
25
25
  msgid ""
26
26
  "There's no current state set. In async code, did you activate the initial"
27
27
  " state? (e.g., `await sm.activate_initial_state()`)"
@@ -5,7 +5,7 @@ msgid ""
5
5
  msgstr ""
6
6
  "Project-Id-Version: 3.1.1\n"
7
7
  "Report-Msgid-Bugs-To: fgmacedo@gmail.com\n"
8
- "POT-Creation-Date: 2026-05-15 12:08-0300\n"
8
+ "POT-Creation-Date: 2026-05-18 16:16-0300\n"
9
9
  "PO-Revision-Date: 2024-06-07 17:41-0300\n"
10
10
  "Last-Translator: Fernando Macedo <fgmacedo@gmail.com>\n"
11
11
  "Language: pt_BR\n"
@@ -21,7 +21,7 @@ msgstr ""
21
21
  msgid "Did not found name '{}' from model or statemachine"
22
22
  msgstr "Nome '{}' não encontrado no modelo ou na máquina de estados"
23
23
 
24
- #: statemachine/configuration.py:121
24
+ #: statemachine/configuration.py:129
25
25
  msgid ""
26
26
  "There's no current state set. In async code, did you activate the initial"
27
27
  " state? (e.g., `await sm.activate_initial_state()`)"
@@ -5,7 +5,7 @@ msgid ""
5
5
  msgstr ""
6
6
  "Project-Id-Version: 3.1.1\n"
7
7
  "Report-Msgid-Bugs-To: fgmacedo@gmail.com\n"
8
- "POT-Creation-Date: 2026-05-15 12:08-0300\n"
8
+ "POT-Creation-Date: 2026-05-18 16:16-0300\n"
9
9
  "PO-Revision-Date: 2024-06-07 17:41-0300\n"
10
10
  "Last-Translator: Fernando Macedo <fgmacedo@gmail.com>\n"
11
11
  "Language: zh_CN\n"
@@ -21,7 +21,7 @@ msgstr ""
21
21
  msgid "Did not found name '{}' from model or statemachine"
22
22
  msgstr "在模型或状态机中未找到名称 '{}'"
23
23
 
24
- #: statemachine/configuration.py:121
24
+ #: statemachine/configuration.py:129
25
25
  msgid ""
26
26
  "There's no current state set. In async code, did you activate the initial"
27
27
  " state? (e.g., `await sm.activate_initial_state()`)"
@@ -37,9 +37,7 @@ msgstr "无法解析布尔表达式 '{}'"
37
37
  msgid ""
38
38
  "Event() received a non-string 'id' ({cls_name}). To combine multiple "
39
39
  "transitions under one event, use the | operator: t1 | t2."
40
- msgstr ""
41
- "Event() 接收到的 'id' 不是字符串 ({cls_name})。要将多个转换组合在同一个事件下,"
42
- "请使用 | 运算符:t1 | t2。"
40
+ msgstr "Event() 接收到的 'id' 不是字符串 ({cls_name})。要将多个转换组合在同一个事件下,请使用 | 运算符:t1 | t2。"
43
41
 
44
42
  #: statemachine/event.py:131
45
43
  #, python-brace-format