python-library-reactive-model 0.1.0__tar.gz → 0.1.1__tar.gz
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_library_reactive_model-0.1.0 → python_library_reactive_model-0.1.1}/PKG-INFO +1 -1
- {python_library_reactive_model-0.1.0 → python_library_reactive_model-0.1.1}/pyproject.toml +1 -1
- {python_library_reactive_model-0.1.0 → python_library_reactive_model-0.1.1}/reactive_model/computed.py +8 -1
- {python_library_reactive_model-0.1.0 → python_library_reactive_model-0.1.1}/.gitignore +0 -0
- {python_library_reactive_model-0.1.0 → python_library_reactive_model-0.1.1}/reactive_model/__init__.py +0 -0
- {python_library_reactive_model-0.1.0 → python_library_reactive_model-0.1.1}/reactive_model/dict_ref.py +0 -0
- {python_library_reactive_model-0.1.0 → python_library_reactive_model-0.1.1}/reactive_model/list_ref.py +0 -0
- {python_library_reactive_model-0.1.0 → python_library_reactive_model-0.1.1}/reactive_model/reactive.py +0 -0
- {python_library_reactive_model-0.1.0 → python_library_reactive_model-0.1.1}/reactive_model/ref.py +0 -0
- {python_library_reactive_model-0.1.0 → python_library_reactive_model-0.1.1}/reactive_model/track.py +0 -0
- {python_library_reactive_model-0.1.0 → python_library_reactive_model-0.1.1}/test.bat +0 -0
- {python_library_reactive_model-0.1.0 → python_library_reactive_model-0.1.1}/tests/test_reactive_model.py +0 -0
|
@@ -10,7 +10,11 @@ _MISSING = object()
|
|
|
10
10
|
|
|
11
11
|
|
|
12
12
|
class ComputedModel(ReactiveModel[T]):
|
|
13
|
-
def __init__(self, expr: Callable[[], T]) -> None:
|
|
13
|
+
def __init__(self, expr: Callable[[], T]=None) -> None:
|
|
14
|
+
"""
|
|
15
|
+
Args:
|
|
16
|
+
expr: The expression to compute the value.
|
|
17
|
+
"""
|
|
14
18
|
super().__init__()
|
|
15
19
|
self._expr = expr
|
|
16
20
|
self._cache: T | object = _MISSING
|
|
@@ -40,6 +44,9 @@ class ComputedModel(ReactiveModel[T]):
|
|
|
40
44
|
return False
|
|
41
45
|
|
|
42
46
|
def _recompute(self) -> None:
|
|
47
|
+
if self._expr is None:
|
|
48
|
+
raise ValueError("require expr to compute")
|
|
49
|
+
|
|
43
50
|
collector = Collector()
|
|
44
51
|
|
|
45
52
|
with compute_context(self, collector):
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{python_library_reactive_model-0.1.0 → python_library_reactive_model-0.1.1}/reactive_model/ref.py
RENAMED
|
File without changes
|
{python_library_reactive_model-0.1.0 → python_library_reactive_model-0.1.1}/reactive_model/track.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|