python-statemachine 3.1.2__py3-none-any.whl → 3.2.0__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.
Files changed (59) hide show
  1. {python_statemachine-3.1.2.dist-info → python_statemachine-3.2.0.dist-info}/METADATA +16 -3
  2. python_statemachine-3.2.0.dist-info/RECORD +72 -0
  3. {python_statemachine-3.1.2.dist-info → python_statemachine-3.2.0.dist-info}/WHEEL +1 -1
  4. statemachine/__init__.py +1 -1
  5. statemachine/callbacks.py +5 -11
  6. statemachine/configuration.py +5 -6
  7. statemachine/contrib/diagram/extract.py +23 -24
  8. statemachine/contrib/diagram/formatter.py +5 -7
  9. statemachine/contrib/diagram/model.py +9 -11
  10. statemachine/contrib/diagram/renderers/dot.py +20 -26
  11. statemachine/contrib/diagram/renderers/mermaid.py +36 -40
  12. statemachine/contrib/diagram/renderers/table.py +7 -9
  13. statemachine/contrib/weighted.py +7 -11
  14. statemachine/dispatcher.py +13 -12
  15. statemachine/engines/async_.py +5 -6
  16. statemachine/engines/base.py +12 -14
  17. statemachine/event.py +1 -2
  18. statemachine/exceptions.py +1 -1
  19. statemachine/factory.py +11 -15
  20. statemachine/graph.py +2 -2
  21. statemachine/invoke.py +12 -11
  22. statemachine/io/__init__.py +45 -225
  23. statemachine/io/{scxml/actions.py → actions.py} +158 -288
  24. statemachine/io/builder.py +195 -0
  25. statemachine/io/class_factory.py +236 -0
  26. statemachine/io/evaluators.py +275 -0
  27. statemachine/io/interpreter.py +128 -0
  28. statemachine/io/{scxml/invoke.py → invoke.py} +77 -49
  29. statemachine/io/json/__init__.py +1 -0
  30. statemachine/io/json/reader.py +27 -0
  31. statemachine/io/loader.py +161 -0
  32. statemachine/io/model.py +268 -0
  33. statemachine/io/native.py +402 -0
  34. statemachine/io/ports.py +83 -0
  35. statemachine/io/schemas/statechart.schema.json +258 -0
  36. statemachine/io/scxml/__init__.py +12 -0
  37. statemachine/io/scxml/processor.py +23 -253
  38. statemachine/io/scxml/{parser.py → reader.py} +64 -47
  39. statemachine/io/system_variables.py +184 -0
  40. statemachine/io/validation.py +44 -0
  41. statemachine/io/yaml/__init__.py +1 -0
  42. statemachine/io/yaml/reader.py +65 -0
  43. statemachine/locale/en/LC_MESSAGES/statemachine.po +19 -19
  44. statemachine/locale/hi_IN/LC_MESSAGES/statemachine.po +19 -19
  45. statemachine/locale/pt_BR/LC_MESSAGES/statemachine.po +19 -19
  46. statemachine/locale/zh_CN/LC_MESSAGES/statemachine.po +19 -19
  47. statemachine/orderedset.py +3 -3
  48. statemachine/registry.py +1 -4
  49. statemachine/signature.py +2 -5
  50. statemachine/spec_parser.py +171 -42
  51. statemachine/state.py +5 -6
  52. statemachine/statemachine.py +18 -20
  53. statemachine/states.py +3 -5
  54. statemachine/transition.py +3 -4
  55. statemachine/transition_list.py +4 -5
  56. statemachine/transition_mixin.py +1 -1
  57. python_statemachine-3.1.2.dist-info/RECORD +0 -58
  58. statemachine/io/scxml/schema.py +0 -175
  59. {python_statemachine-3.1.2.dist-info → python_statemachine-3.2.0.dist-info}/licenses/LICENSE +0 -0
@@ -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-18 16:16-0300\n"
8
+ "POT-Creation-Date: 2026-06-16 23:00-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"
@@ -16,12 +16,12 @@ msgstr ""
16
16
  "Content-Transfer-Encoding: 8bit\n"
17
17
  "Generated-By: Babel 2.18.0\n"
18
18
 
19
- #: statemachine/callbacks.py:404 statemachine/callbacks.py:409
19
+ #: statemachine/callbacks.py:398 statemachine/callbacks.py:403
20
20
  #, python-brace-format
21
21
  msgid "Did not found name '{}' from model or statemachine"
22
22
  msgstr "मॉडल या स्टेटमशीन में नाम '{}' नहीं मिला"
23
23
 
24
- #: statemachine/configuration.py:129
24
+ #: statemachine/configuration.py:128
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()`)"
@@ -29,12 +29,12 @@ msgstr ""
29
29
  "कोई वर्तमान स्टेट सेट नहीं है। असिंक्रोनस कोड में, क्या आपने प्रारंभिक "
30
30
  "स्टेट को सक्रिय किया? (उदाहरण: `await sm.activate_initial_state()`)"
31
31
 
32
- #: statemachine/dispatcher.py:126
32
+ #: statemachine/dispatcher.py:123
33
33
  #, python-brace-format
34
34
  msgid "Failed to parse boolean expression '{}'"
35
35
  msgstr "बूलियन अभिव्यक्ति '{}' को पार्स करने में विफल रहा"
36
36
 
37
- #: statemachine/event.py:95
37
+ #: statemachine/event.py:94
38
38
  #, python-brace-format
39
39
  msgid ""
40
40
  "Event() received a non-string 'id' ({cls_name}). To combine multiple "
@@ -43,12 +43,12 @@ msgstr ""
43
43
  "Event() को एक गैर-स्ट्रिंग 'id' ({cls_name}) मिला। एक ही इवेंट के तहत कई "
44
44
  "ट्रांज़िशन को जोड़ने के लिए, | ऑपरेटर का उपयोग करें: t1 | t2।"
45
45
 
46
- #: statemachine/event.py:131
46
+ #: statemachine/event.py:130
47
47
  #, python-brace-format
48
48
  msgid "Cannot add callback '{}' to an event with no transitions."
49
49
  msgstr "बिना ट्रांज़िशन वाले इवेंट में कॉलबैक '{}' नहीं जोड़ सकते।"
50
50
 
51
- #: statemachine/event.py:164
51
+ #: statemachine/event.py:163
52
52
  #, python-brace-format
53
53
  msgid "Event {} cannot be called without a SM instance"
54
54
  msgstr "इवेंट {} को SM इंस्टेंस के बिना कॉल नहीं किया जा सकता"
@@ -63,14 +63,14 @@ msgstr "{!r} एक मान्य स्टेट मान नहीं ह
63
63
  msgid "Can't {} when in {}."
64
64
  msgstr "{} स्थिति में {} नहीं कर सकते।"
65
65
 
66
- #: statemachine/factory.py:81
66
+ #: statemachine/factory.py:77
67
67
  #, python-brace-format
68
68
  msgid ""
69
69
  "There should be one and only one initial state. Your currently have "
70
70
  "these: {0}"
71
71
  msgstr "एक और केवल एक प्रारंभिक स्टेट होना चाहिए। वर्तमान में आपके पास ये हैं: {0}"
72
72
 
73
- #: statemachine/factory.py:198
73
+ #: statemachine/factory.py:194
74
74
  #, python-brace-format
75
75
  msgid ""
76
76
  "There should be one and only one initial state. You currently have these:"
@@ -79,12 +79,12 @@ msgstr ""
79
79
  "एक और केवल एक प्रारंभिक स्टेट होना चाहिए। वर्तमान में आपके पास ये हैं: "
80
80
  "{!r}"
81
81
 
82
- #: statemachine/factory.py:213
82
+ #: statemachine/factory.py:209
83
83
  #, python-brace-format
84
84
  msgid "Cannot declare transitions from final state. Invalid state(s): {}"
85
85
  msgstr "अंतिम स्टेट से ट्रांज़िशन घोषित नहीं कर सकते। अमान्य स्टेट: {}"
86
86
 
87
- #: statemachine/factory.py:225
87
+ #: statemachine/factory.py:221
88
88
  #, python-brace-format
89
89
  msgid ""
90
90
  "All non-final states should have at least one outgoing transition. These "
@@ -93,7 +93,7 @@ msgstr ""
93
93
  "सभी गैर-अंतिम स्टेट में कम से कम एक आउटगोइंग ट्रांज़िशन होना चाहिए। इन "
94
94
  "स्टेट में कोई आउटगोइंग ट्रांज़िशन नहीं है: {!r}"
95
95
 
96
- #: statemachine/factory.py:239
96
+ #: statemachine/factory.py:235
97
97
  #, python-brace-format
98
98
  msgid ""
99
99
  "All non-final states should have at least one path to a final state. "
@@ -102,7 +102,7 @@ msgstr ""
102
102
  "सभी गैर-अंतिम स्टेट में अंतिम स्टेट तक कम से कम एक पथ होना चाहिए। इन "
103
103
  "स्टेट में अंतिम स्टेट तक कोई पथ नहीं है: {!r}"
104
104
 
105
- #: statemachine/factory.py:252
105
+ #: statemachine/factory.py:248
106
106
  #, python-brace-format
107
107
  msgid ""
108
108
  "There are unreachable states. The statemachine graph should have a single"
@@ -111,7 +111,7 @@ msgstr ""
111
111
  "कुछ स्टेट पहुंच योग्य नहीं हैं। स्टेटमशीन ग्राफ में एक ही घटक होना चाहिए।"
112
112
  " डिस्कनेक्टेड स्टेट: {}"
113
113
 
114
- #: statemachine/factory.py:289
114
+ #: statemachine/factory.py:285
115
115
  #, python-brace-format
116
116
  msgid ""
117
117
  "Invalid entry in 'listeners': {!r}. Expected a class, callable, or "
@@ -120,7 +120,7 @@ msgstr ""
120
120
  "'listeners' में अमान्य प्रविष्टि: {!r}। एक क्लास, कॉलेबल, या लिसनर "
121
121
  "इंस्टेंस अपेक्षित है।"
122
122
 
123
- #: statemachine/factory.py:388
123
+ #: statemachine/factory.py:384
124
124
  #, python-brace-format
125
125
  msgid "An event in the '{}' has no id."
126
126
  msgstr "'{}' में एक इवेंट का आईडी नहीं है।"
@@ -130,22 +130,22 @@ msgstr "'{}' में एक इवेंट का आईडी नहीं
130
130
  msgid "{!r} is not a valid state machine name."
131
131
  msgstr "{!r} एक मान्य स्टेटमशीन नाम नहीं है।"
132
132
 
133
- #: statemachine/state.py:250
133
+ #: statemachine/state.py:249
134
134
  msgid "'donedata' can only be specified on final states."
135
135
  msgstr "'donedata' केवल अंतिम स्टेट पर निर्दिष्ट किया जा सकता है।"
136
136
 
137
- #: statemachine/statemachine.py:169
137
+ #: statemachine/statemachine.py:167
138
138
  msgid "There are no states or transitions."
139
139
  msgstr "कोई स्टेट या ट्रांज़िशन नहीं हैं।"
140
140
 
141
- #: statemachine/statemachine.py:239
141
+ #: statemachine/statemachine.py:237
142
142
  #, python-brace-format
143
143
  msgid "State overriding is not allowed. Trying to add '{}' to {}"
144
144
  msgstr ""
145
145
  "स्टेट ओवरराइड करना अनुमति नहीं है। '{}' को {} में जोड़ने की कोशिश कर रहे "
146
146
  "हैं"
147
147
 
148
- #: statemachine/transition.py:75
148
+ #: statemachine/transition.py:74
149
149
  #, python-brace-format
150
150
  msgid ""
151
151
  "Not a valid internal transition from source {source!r}, target {target!r}"
@@ -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-18 16:16-0300\n"
8
+ "POT-Creation-Date: 2026-06-16 23:00-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"
@@ -16,12 +16,12 @@ msgstr ""
16
16
  "Content-Transfer-Encoding: 8bit\n"
17
17
  "Generated-By: Babel 2.18.0\n"
18
18
 
19
- #: statemachine/callbacks.py:404 statemachine/callbacks.py:409
19
+ #: statemachine/callbacks.py:398 statemachine/callbacks.py:403
20
20
  #, python-brace-format
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:129
24
+ #: statemachine/configuration.py:128
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()`)"
@@ -29,12 +29,12 @@ msgstr ""
29
29
  "Nenhum estado atual definido. Em código assíncrono, você ativou o estado "
30
30
  "inicial? (ex.: `await sm.activate_initial_state()`)"
31
31
 
32
- #: statemachine/dispatcher.py:126
32
+ #: statemachine/dispatcher.py:123
33
33
  #, python-brace-format
34
34
  msgid "Failed to parse boolean expression '{}'"
35
35
  msgstr "Falha ao interpretar a expressão booleana '{}'"
36
36
 
37
- #: statemachine/event.py:95
37
+ #: statemachine/event.py:94
38
38
  #, python-brace-format
39
39
  msgid ""
40
40
  "Event() received a non-string 'id' ({cls_name}). To combine multiple "
@@ -43,12 +43,12 @@ msgstr ""
43
43
  "Event() recebeu um 'id' que não é uma string ({cls_name}). Para combinar "
44
44
  "múltiplas transições em um único evento, use o operador |: t1 | t2."
45
45
 
46
- #: statemachine/event.py:131
46
+ #: statemachine/event.py:130
47
47
  #, python-brace-format
48
48
  msgid "Cannot add callback '{}' to an event with no transitions."
49
49
  msgstr "Não é possível adicionar callback '{}' a um evento sem transições."
50
50
 
51
- #: statemachine/event.py:164
51
+ #: statemachine/event.py:163
52
52
  #, python-brace-format
53
53
  msgid "Event {} cannot be called without a SM instance"
54
54
  msgstr "O evento {} não pode ser chamado sem uma instância de SM"
@@ -63,7 +63,7 @@ msgstr "{!r} não é um valor de estado válido."
63
63
  msgid "Can't {} when in {}."
64
64
  msgstr "Não é possível {} quando em {}."
65
65
 
66
- #: statemachine/factory.py:81
66
+ #: statemachine/factory.py:77
67
67
  #, python-brace-format
68
68
  msgid ""
69
69
  "There should be one and only one initial state. Your currently have "
@@ -72,7 +72,7 @@ msgstr ""
72
72
  "Deve haver um e apenas um estado inicial. Atualmente, você possui estes: "
73
73
  "{0}"
74
74
 
75
- #: statemachine/factory.py:198
75
+ #: statemachine/factory.py:194
76
76
  #, python-brace-format
77
77
  msgid ""
78
78
  "There should be one and only one initial state. You currently have these:"
@@ -81,14 +81,14 @@ msgstr ""
81
81
  "Deve haver um e apenas um estado inicial. Atualmente, você possui estes: "
82
82
  "{!r}"
83
83
 
84
- #: statemachine/factory.py:213
84
+ #: statemachine/factory.py:209
85
85
  #, python-brace-format
86
86
  msgid "Cannot declare transitions from final state. Invalid state(s): {}"
87
87
  msgstr ""
88
88
  "Não é possível declarar transições a partir de um estado final. Estado(s)"
89
89
  " inválido(s): {}"
90
90
 
91
- #: statemachine/factory.py:225
91
+ #: statemachine/factory.py:221
92
92
  #, python-brace-format
93
93
  msgid ""
94
94
  "All non-final states should have at least one outgoing transition. These "
@@ -97,7 +97,7 @@ msgstr ""
97
97
  "Todos os estados não finais devem ter pelo menos uma transição de saída. "
98
98
  "Estes estados não possuem transição de saída: {!r}"
99
99
 
100
- #: statemachine/factory.py:239
100
+ #: statemachine/factory.py:235
101
101
  #, python-brace-format
102
102
  msgid ""
103
103
  "All non-final states should have at least one path to a final state. "
@@ -107,7 +107,7 @@ msgstr ""
107
107
  "estado final. Estes estados não possuem caminho para um estado final: "
108
108
  "{!r}"
109
109
 
110
- #: statemachine/factory.py:252
110
+ #: statemachine/factory.py:248
111
111
  #, python-brace-format
112
112
  msgid ""
113
113
  "There are unreachable states. The statemachine graph should have a single"
@@ -116,7 +116,7 @@ msgstr ""
116
116
  "Há estados inacessíveis. O grafo da máquina de estados deve ter um único "
117
117
  "componente. Estados desconectados: {}"
118
118
 
119
- #: statemachine/factory.py:289
119
+ #: statemachine/factory.py:285
120
120
  #, python-brace-format
121
121
  msgid ""
122
122
  "Invalid entry in 'listeners': {!r}. Expected a class, callable, or "
@@ -125,7 +125,7 @@ msgstr ""
125
125
  "Entrada inválida em 'listeners': {!r}. Esperado uma classe, callable ou "
126
126
  "instância de listener."
127
127
 
128
- #: statemachine/factory.py:388
128
+ #: statemachine/factory.py:384
129
129
  #, python-brace-format
130
130
  msgid "An event in the '{}' has no id."
131
131
  msgstr "Um evento em '{}' não possui id."
@@ -135,20 +135,20 @@ msgstr "Um evento em '{}' não possui id."
135
135
  msgid "{!r} is not a valid state machine name."
136
136
  msgstr "{!r} não é um nome de máquina de estados válido."
137
137
 
138
- #: statemachine/state.py:250
138
+ #: statemachine/state.py:249
139
139
  msgid "'donedata' can only be specified on final states."
140
140
  msgstr "'donedata' só pode ser especificado em estados finais."
141
141
 
142
- #: statemachine/statemachine.py:169
142
+ #: statemachine/statemachine.py:167
143
143
  msgid "There are no states or transitions."
144
144
  msgstr "Não há estados ou transições."
145
145
 
146
- #: statemachine/statemachine.py:239
146
+ #: statemachine/statemachine.py:237
147
147
  #, python-brace-format
148
148
  msgid "State overriding is not allowed. Trying to add '{}' to {}"
149
149
  msgstr "Sobrescrever estados não é permitido. Tentando adicionar '{}' a {}"
150
150
 
151
- #: statemachine/transition.py:75
151
+ #: statemachine/transition.py:74
152
152
  #, python-brace-format
153
153
  msgid ""
154
154
  "Not a valid internal transition from source {source!r}, target {target!r}"
@@ -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-18 16:16-0300\n"
8
+ "POT-Creation-Date: 2026-06-16 23:00-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"
@@ -16,35 +16,35 @@ msgstr ""
16
16
  "Content-Transfer-Encoding: 8bit\n"
17
17
  "Generated-By: Babel 2.18.0\n"
18
18
 
19
- #: statemachine/callbacks.py:404 statemachine/callbacks.py:409
19
+ #: statemachine/callbacks.py:398 statemachine/callbacks.py:403
20
20
  #, python-brace-format
21
21
  msgid "Did not found name '{}' from model or statemachine"
22
22
  msgstr "在模型或状态机中未找到名称 '{}'"
23
23
 
24
- #: statemachine/configuration.py:129
24
+ #: statemachine/configuration.py:128
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()`)"
28
28
  msgstr "没有设置当前状态。在异步代码中,您是否激活了初始状态?(例如,`await sm.activate_initial_state()`)"
29
29
 
30
- #: statemachine/dispatcher.py:126
30
+ #: statemachine/dispatcher.py:123
31
31
  #, python-brace-format
32
32
  msgid "Failed to parse boolean expression '{}'"
33
33
  msgstr "无法解析布尔表达式 '{}'"
34
34
 
35
- #: statemachine/event.py:95
35
+ #: statemachine/event.py:94
36
36
  #, python-brace-format
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
40
  msgstr "Event() 接收到的 'id' 不是字符串 ({cls_name})。要将多个转换组合在同一个事件下,请使用 | 运算符:t1 | t2。"
41
41
 
42
- #: statemachine/event.py:131
42
+ #: statemachine/event.py:130
43
43
  #, python-brace-format
44
44
  msgid "Cannot add callback '{}' to an event with no transitions."
45
45
  msgstr "无法将回调 '{}' 添加到没有转换的事件。"
46
46
 
47
- #: statemachine/event.py:164
47
+ #: statemachine/event.py:163
48
48
  #, python-brace-format
49
49
  msgid "Event {} cannot be called without a SM instance"
50
50
  msgstr "事件 {} 不能在没有 SM 实例的情况下调用"
@@ -59,54 +59,54 @@ msgstr "{!r} 不是有效的状态值。"
59
59
  msgid "Can't {} when in {}."
60
60
  msgstr "在 {} 时无法 {}。"
61
61
 
62
- #: statemachine/factory.py:81
62
+ #: statemachine/factory.py:77
63
63
  #, python-brace-format
64
64
  msgid ""
65
65
  "There should be one and only one initial state. Your currently have "
66
66
  "these: {0}"
67
67
  msgstr "应有且仅有一个初始状态。当前您有这些:{0}"
68
68
 
69
- #: statemachine/factory.py:198
69
+ #: statemachine/factory.py:194
70
70
  #, python-brace-format
71
71
  msgid ""
72
72
  "There should be one and only one initial state. You currently have these:"
73
73
  " {!r}"
74
74
  msgstr "应有且仅有一个初始状态。当前您有这些:{!r}"
75
75
 
76
- #: statemachine/factory.py:213
76
+ #: statemachine/factory.py:209
77
77
  #, python-brace-format
78
78
  msgid "Cannot declare transitions from final state. Invalid state(s): {}"
79
79
  msgstr "无法从终止状态声明转换。无效状态:{}"
80
80
 
81
- #: statemachine/factory.py:225
81
+ #: statemachine/factory.py:221
82
82
  #, python-brace-format
83
83
  msgid ""
84
84
  "All non-final states should have at least one outgoing transition. These "
85
85
  "states have no outgoing transition: {!r}"
86
86
  msgstr "所有非终止状态都应至少有一个外部转换。这些状态没有外部转换:{!r}"
87
87
 
88
- #: statemachine/factory.py:239
88
+ #: statemachine/factory.py:235
89
89
  #, python-brace-format
90
90
  msgid ""
91
91
  "All non-final states should have at least one path to a final state. "
92
92
  "These states have no path to a final state: {!r}"
93
93
  msgstr "所有非终止状态应至少有一个到终止状态的路径。这些状态没有到终止状态的路径:{!r}"
94
94
 
95
- #: statemachine/factory.py:252
95
+ #: statemachine/factory.py:248
96
96
  #, python-brace-format
97
97
  msgid ""
98
98
  "There are unreachable states. The statemachine graph should have a single"
99
99
  " component. Disconnected states: {}"
100
100
  msgstr "存在不可到达的状态。状态机图应具有单个组件。断开的状态:{}"
101
101
 
102
- #: statemachine/factory.py:289
102
+ #: statemachine/factory.py:285
103
103
  #, python-brace-format
104
104
  msgid ""
105
105
  "Invalid entry in 'listeners': {!r}. Expected a class, callable, or "
106
106
  "listener instance."
107
107
  msgstr "'listeners' 中的条目无效:{!r}。期望为类、可调用对象或监听器实例。"
108
108
 
109
- #: statemachine/factory.py:388
109
+ #: statemachine/factory.py:384
110
110
  #, python-brace-format
111
111
  msgid "An event in the '{}' has no id."
112
112
  msgstr "'{}' 中的事件没有 ID。"
@@ -116,20 +116,20 @@ msgstr "'{}' 中的事件没有 ID。"
116
116
  msgid "{!r} is not a valid state machine name."
117
117
  msgstr "{!r} 不是有效的状态机名称。"
118
118
 
119
- #: statemachine/state.py:250
119
+ #: statemachine/state.py:249
120
120
  msgid "'donedata' can only be specified on final states."
121
121
  msgstr "'donedata' 只能在终止状态上指定。"
122
122
 
123
- #: statemachine/statemachine.py:169
123
+ #: statemachine/statemachine.py:167
124
124
  msgid "There are no states or transitions."
125
125
  msgstr "没有状态或转换。"
126
126
 
127
- #: statemachine/statemachine.py:239
127
+ #: statemachine/statemachine.py:237
128
128
  #, python-brace-format
129
129
  msgid "State overriding is not allowed. Trying to add '{}' to {}"
130
130
  msgstr "不允许覆盖状态。尝试将 '{}' 添加到 {}"
131
131
 
132
- #: statemachine/transition.py:75
132
+ #: statemachine/transition.py:74
133
133
  #, python-brace-format
134
134
  msgid ""
135
135
  "Not a valid internal transition from source {source!r}, target {target!r}"
@@ -1,7 +1,7 @@
1
1
  import itertools
2
- from typing import Iterable
3
- from typing import Iterator
4
- from typing import MutableSet
2
+ from collections.abc import Iterable
3
+ from collections.abc import Iterator
4
+ from collections.abc import MutableSet
5
5
  from typing import TypeVar
6
6
 
7
7
  T = TypeVar("T")
statemachine/registry.py CHANGED
@@ -1,6 +1,3 @@
1
- from typing import List
2
- from typing import Optional
3
-
4
1
  from .utils import qualname
5
2
 
6
3
  try:
@@ -32,6 +29,6 @@ def init_registry():
32
29
  _initialized = True
33
30
 
34
31
 
35
- def load_modules(modules: Optional[List[str]] = None) -> None:
32
+ def load_modules(modules: list[str] | None = None) -> None:
36
33
  for module in modules or []:
37
34
  autodiscover_modules(module)
statemachine/signature.py CHANGED
@@ -8,12 +8,9 @@ from inspect import iscoroutinefunction
8
8
  from itertools import chain
9
9
  from types import MethodType
10
10
  from typing import Any
11
- from typing import FrozenSet
12
- from typing import Optional
13
- from typing import Tuple
14
11
 
15
- BindCacheKey = Tuple[int, FrozenSet[str]]
16
- BindTemplate = Tuple[Tuple[str, ...], Optional[str], Optional[str]] # noqa: UP007
12
+ BindCacheKey = tuple[int, frozenset[str]]
13
+ BindTemplate = tuple[tuple[str, ...], str | None, str | None] # noqa: UP007
17
14
 
18
15
 
19
16
  def _make_key(method):