hmr 0.0.3.1__py3-none-any.whl → 0.0.3.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.
- {hmr-0.0.3.1.dist-info → hmr-0.0.3.2.dist-info}/METADATA +1 -1
- hmr-0.0.3.2.dist-info/RECORD +9 -0
- reactivity/helpers.py +13 -10
- reactivity/hmr.py +2 -2
- hmr-0.0.3.1.dist-info/RECORD +0 -9
- {hmr-0.0.3.1.dist-info → hmr-0.0.3.2.dist-info}/WHEEL +0 -0
- {hmr-0.0.3.1.dist-info → hmr-0.0.3.2.dist-info}/entry_points.txt +0 -0
@@ -0,0 +1,9 @@
|
|
1
|
+
hmr-0.0.3.2.dist-info/METADATA,sha256=73QkWBxFTh8L4MSuk_PtejSzm1PGO1rTIQsAo2Xx3dQ,230
|
2
|
+
hmr-0.0.3.2.dist-info/WHEEL,sha256=thaaA2w1JzcGC48WYufAs8nrYZjJm8LqNfnXFOFyCC4,90
|
3
|
+
hmr-0.0.3.2.dist-info/entry_points.txt,sha256=g_T0uJ43WgsdG14kkkdaBQuIL0HO-m1qvtjXMP6d060,59
|
4
|
+
reactivity/__init__.py,sha256=pX-RUzkezCC1x4eOWGxNhXbwrbvBLP_3pQuZr9eZz1Y,300
|
5
|
+
reactivity/functional.py,sha256=U06vshcVhZ0sb218gcmHtEhfgTNAGtQ7zyvPz2w5qKM,1292
|
6
|
+
reactivity/helpers.py,sha256=1KmMCO6lqluHlMsjGQQ9UJZBtbFppjFZnmi9RhowRHo,3872
|
7
|
+
reactivity/hmr.py,sha256=WyNdlk-MS9e93H6b7_KQ3BZ7Wj5MOq_mMJJ8nnbCw2A,8569
|
8
|
+
reactivity/primitives.py,sha256=lw4G3GpANRGK5dKw11eYc2-nlOJ1uCO3f3MiLa41jG8,3588
|
9
|
+
hmr-0.0.3.2.dist-info/RECORD,,
|
reactivity/helpers.py
CHANGED
@@ -16,26 +16,29 @@ class Memoized[T](Subscribable, BaseComputation[T]):
|
|
16
16
|
self._recompute = False
|
17
17
|
|
18
18
|
def trigger(self):
|
19
|
+
self.track()
|
19
20
|
if self._recompute:
|
21
|
+
self._recompute = False
|
20
22
|
self._before()
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
23
|
+
try:
|
24
|
+
self.cached_value = self.fn()
|
25
|
+
self.is_stale = False
|
26
|
+
finally:
|
27
|
+
self._after()
|
28
|
+
else:
|
29
|
+
self.invalidate()
|
28
30
|
|
29
31
|
def __call__(self):
|
30
32
|
if self.is_stale:
|
31
33
|
self._recompute = True
|
32
34
|
self.trigger()
|
33
|
-
self._recompute
|
35
|
+
assert not self._recompute
|
34
36
|
return self.cached_value
|
35
37
|
|
36
38
|
def invalidate(self):
|
37
|
-
|
38
|
-
|
39
|
+
if not self.is_stale:
|
40
|
+
del self.cached_value
|
41
|
+
self.is_stale = True
|
39
42
|
|
40
43
|
|
41
44
|
class MemoizedProperty[T, I]:
|
reactivity/hmr.py
CHANGED
@@ -98,7 +98,7 @@ class ReactiveModuleLoader(Loader):
|
|
98
98
|
namespace = {"__file__": str(self._file), "__spec__": spec, "__loader__": self}
|
99
99
|
if self._is_package:
|
100
100
|
assert self._file.name == "__init__.py"
|
101
|
-
namespace["__path__"] = [str(self._file.parent
|
101
|
+
namespace["__path__"] = [str(self._file.parent)]
|
102
102
|
return ReactiveModule(self._file, namespace, spec.name)
|
103
103
|
|
104
104
|
def exec_module(self, module: ModuleType):
|
@@ -249,4 +249,4 @@ def cli():
|
|
249
249
|
SyncReloader(entry, excludes={".venv"}).keep_watching_until_interrupt()
|
250
250
|
|
251
251
|
|
252
|
-
__version__ = "0.0.3.
|
252
|
+
__version__ = "0.0.3.2"
|
hmr-0.0.3.1.dist-info/RECORD
DELETED
@@ -1,9 +0,0 @@
|
|
1
|
-
hmr-0.0.3.1.dist-info/METADATA,sha256=lb041EpepaHAh0yvImQPiVofZkBEEnNJ4gQYy2Sv-d0,230
|
2
|
-
hmr-0.0.3.1.dist-info/WHEEL,sha256=thaaA2w1JzcGC48WYufAs8nrYZjJm8LqNfnXFOFyCC4,90
|
3
|
-
hmr-0.0.3.1.dist-info/entry_points.txt,sha256=g_T0uJ43WgsdG14kkkdaBQuIL0HO-m1qvtjXMP6d060,59
|
4
|
-
reactivity/__init__.py,sha256=pX-RUzkezCC1x4eOWGxNhXbwrbvBLP_3pQuZr9eZz1Y,300
|
5
|
-
reactivity/functional.py,sha256=U06vshcVhZ0sb218gcmHtEhfgTNAGtQ7zyvPz2w5qKM,1292
|
6
|
-
reactivity/helpers.py,sha256=OogpUAsVnXX60Ib3ckcVWrJX9jwYfYAKFwUEJw3UcsM,3800
|
7
|
-
reactivity/hmr.py,sha256=kBwaVLFCHRz0CX_f5AgTc0Yq8Avknjjnv0LkzGLu4UM,8576
|
8
|
-
reactivity/primitives.py,sha256=lw4G3GpANRGK5dKw11eYc2-nlOJ1uCO3f3MiLa41jG8,3588
|
9
|
-
hmr-0.0.3.1.dist-info/RECORD,,
|
File without changes
|
File without changes
|