python-statemachine 3.1.0__py3-none-any.whl → 3.1.1__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.
- {python_statemachine-3.1.0.dist-info → python_statemachine-3.1.1.dist-info}/METADATA +1 -1
- {python_statemachine-3.1.0.dist-info → python_statemachine-3.1.1.dist-info}/RECORD +10 -10
- statemachine/__init__.py +1 -1
- statemachine/configuration.py +14 -6
- statemachine/locale/en/LC_MESSAGES/statemachine.po +1 -1
- statemachine/locale/hi_IN/LC_MESSAGES/statemachine.po +1 -1
- statemachine/locale/pt_BR/LC_MESSAGES/statemachine.po +1 -1
- statemachine/locale/zh_CN/LC_MESSAGES/statemachine.po +1 -1
- {python_statemachine-3.1.0.dist-info → python_statemachine-3.1.1.dist-info}/WHEEL +0 -0
- {python_statemachine-3.1.0.dist-info → python_statemachine-3.1.1.dist-info}/licenses/LICENSE +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
statemachine/__init__.py,sha256=
|
|
1
|
+
statemachine/__init__.py,sha256=6QmaIOvUXefWn7Ur1IFrqnM8ehtcwtnPrvRE44ELq4w,445
|
|
2
2
|
statemachine/callbacks.py,sha256=mY_RAl86240vG2C94ij6AdD7CgsIM8mr0wvpSAMAPv0,14644
|
|
3
|
-
statemachine/configuration.py,sha256=
|
|
3
|
+
statemachine/configuration.py,sha256=5tTx4-_cXnu6apxdvUfhfhDe6zym9BJynqQ-lrIxnls,6018
|
|
4
4
|
statemachine/dispatcher.py,sha256=xvA1Kf1xGQivHTpaGm_HC22vqAmE_tTm9LQwyVLRWLE,7841
|
|
5
5
|
statemachine/event.py,sha256=d_Ky5ph30Os305BceN4x-rftZH-h8G1U5ei34-66lnI,7669
|
|
6
6
|
statemachine/event_data.py,sha256=7_hoE0cp-0uW71Kk3erO3eYM6anTT5X3slGMcehIGIo,3111
|
|
@@ -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=
|
|
52
|
-
statemachine/locale/hi_IN/LC_MESSAGES/statemachine.po,sha256=
|
|
53
|
-
statemachine/locale/pt_BR/LC_MESSAGES/statemachine.po,sha256=
|
|
54
|
-
statemachine/locale/zh_CN/LC_MESSAGES/statemachine.po,sha256=
|
|
55
|
-
python_statemachine-3.1.
|
|
56
|
-
python_statemachine-3.1.
|
|
57
|
-
python_statemachine-3.1.
|
|
58
|
-
python_statemachine-3.1.
|
|
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,,
|
statemachine/__init__.py
CHANGED
statemachine/configuration.py
CHANGED
|
@@ -73,8 +73,13 @@ class Configuration:
|
|
|
73
73
|
def states(self) -> "OrderedSet[State]":
|
|
74
74
|
"""The set of currently active :class:`State` instances (cached)."""
|
|
75
75
|
raw = self.value
|
|
76
|
-
|
|
77
|
-
|
|
76
|
+
# Snapshot the cache fields locally — another thread may call
|
|
77
|
+
# ``_invalidate()`` between the freshness check and the return,
|
|
78
|
+
# so reading ``self._cached`` twice would risk returning ``None``.
|
|
79
|
+
cached = self._cached
|
|
80
|
+
cached_value = self._cached_value
|
|
81
|
+
if cached is not None and cached_value is raw:
|
|
82
|
+
return cached
|
|
78
83
|
if raw is None:
|
|
79
84
|
return OrderedSet()
|
|
80
85
|
|
|
@@ -92,14 +97,17 @@ class Configuration:
|
|
|
92
97
|
# -- Incremental mutation (used by the engine) -----------------------------
|
|
93
98
|
|
|
94
99
|
def add(self, state: "State"):
|
|
95
|
-
"""Add *state* to the configuration."""
|
|
96
|
-
|
|
100
|
+
"""Add *state* to the configuration (copy-on-write for thread safety)."""
|
|
101
|
+
# Copy so we never mutate the OrderedSet still held by concurrent
|
|
102
|
+
# readers or by the cache identity check. ``_read_from_model`` may
|
|
103
|
+
# return the same ref stored on the model.
|
|
104
|
+
values = OrderedSet(self._read_from_model())
|
|
97
105
|
values.add(state.value)
|
|
98
106
|
self._write_to_model(values)
|
|
99
107
|
|
|
100
108
|
def discard(self, state: "State"):
|
|
101
|
-
"""Remove *state* from the configuration."""
|
|
102
|
-
values = self._read_from_model()
|
|
109
|
+
"""Remove *state* from the configuration (copy-on-write for thread safety)."""
|
|
110
|
+
values = OrderedSet(self._read_from_model())
|
|
103
111
|
values.discard(state.value)
|
|
104
112
|
self._write_to_model(values)
|
|
105
113
|
|
|
File without changes
|
{python_statemachine-3.1.0.dist-info → python_statemachine-3.1.1.dist-info}/licenses/LICENSE
RENAMED
|
File without changes
|