hmr 0.0.1.1__py3-none-any.whl → 0.0.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.1.1.dist-info → hmr-0.0.2.dist-info}/METADATA +1 -1
- hmr-0.0.2.dist-info/RECORD +9 -0
- reactivity/helpers.py +7 -2
- reactivity/hmr.py +3 -2
- reactivity/primitives.py +3 -3
- hmr-0.0.1.1.dist-info/RECORD +0 -9
- {hmr-0.0.1.1.dist-info → hmr-0.0.2.dist-info}/WHEEL +0 -0
- {hmr-0.0.1.1.dist-info → hmr-0.0.2.dist-info}/entry_points.txt +0 -0
@@ -0,0 +1,9 @@
|
|
1
|
+
hmr-0.0.2.dist-info/METADATA,sha256=duLyWpJHm02MnF37QbCMk-0EebdOcZ4hVnO0xhFgL7I,228
|
2
|
+
hmr-0.0.2.dist-info/WHEEL,sha256=thaaA2w1JzcGC48WYufAs8nrYZjJm8LqNfnXFOFyCC4,90
|
3
|
+
hmr-0.0.2.dist-info/entry_points.txt,sha256=g_T0uJ43WgsdG14kkkdaBQuIL0HO-m1qvtjXMP6d060,59
|
4
|
+
reactivity/__init__.py,sha256=Stl2BBvqzutjcmF-O-olFTbSzJxzAl1xNMbu8mAVjlo,320
|
5
|
+
reactivity/functional.py,sha256=KAsqgPQsxIGuqO4BAtH6VF78MigLSBQ2k3aL4o_Vffg,1290
|
6
|
+
reactivity/helpers.py,sha256=auLTDFjfFc-cU9kVfm356GALW9lJIQ_UV7LGRZ2fWIw,3434
|
7
|
+
reactivity/hmr.py,sha256=MI9LV1eU5hs_v3bIIS_ANDIDLas76ULZ60A6rZiJDK4,7585
|
8
|
+
reactivity/primitives.py,sha256=EIa_-5XOhffKw_lJ13EoAmFD3l0u_LFG1pJbODZSpMw,3351
|
9
|
+
hmr-0.0.2.dist-info/RECORD,,
|
reactivity/helpers.py
CHANGED
@@ -5,7 +5,7 @@ from weakref import WeakKeyDictionary
|
|
5
5
|
from .primitives import BaseComputation, Batch, Signal, Subscribable
|
6
6
|
|
7
7
|
|
8
|
-
class Memoized[T](Subscribable, BaseComputation):
|
8
|
+
class Memoized[T](Subscribable, BaseComputation[T]):
|
9
9
|
def __init__(self, fn: Callable[[], T]):
|
10
10
|
super().__init__()
|
11
11
|
self.fn = fn
|
@@ -53,9 +53,14 @@ class MemoizedMethod[T, Self]:
|
|
53
53
|
def __init__(self, method: Callable[[Self], T]):
|
54
54
|
super().__init__()
|
55
55
|
self.method = method
|
56
|
+
self.map = WeakKeyDictionary[Self, Memoized]()
|
56
57
|
|
57
58
|
def __get__(self, instance, owner):
|
58
|
-
|
59
|
+
try:
|
60
|
+
return self.map[instance]
|
61
|
+
except KeyError:
|
62
|
+
self.map[instance] = memo = Memoized(partial(self.method, instance))
|
63
|
+
return memo
|
59
64
|
|
60
65
|
|
61
66
|
class Reactive[K, V](Subscribable, MutableMapping[K, V]):
|
reactivity/hmr.py
CHANGED
@@ -152,12 +152,13 @@ class BaseReloader:
|
|
152
152
|
if type is Change.modified:
|
153
153
|
path = Path(file).resolve()
|
154
154
|
if path.samefile(self.entry):
|
155
|
-
self.run_entry_file()
|
155
|
+
self.run_entry_file.trigger()
|
156
156
|
elif module := path2module.get(path):
|
157
157
|
try:
|
158
158
|
module.load()
|
159
159
|
except Exception as e:
|
160
160
|
sys.excepthook(e.__class__, e, e.__traceback__)
|
161
|
+
self.run_entry_file()
|
161
162
|
|
162
163
|
|
163
164
|
class SyncReloader(BaseReloader):
|
@@ -218,4 +219,4 @@ def cli():
|
|
218
219
|
SyncReloader(entry, excludes={".venv"}).keep_watching_until_interrupt()
|
219
220
|
|
220
221
|
|
221
|
-
__version__ = "0.0.
|
222
|
+
__version__ = "0.0.2"
|
reactivity/primitives.py
CHANGED
@@ -22,7 +22,7 @@ class Subscribable:
|
|
22
22
|
subscriber.trigger()
|
23
23
|
|
24
24
|
|
25
|
-
class BaseComputation:
|
25
|
+
class BaseComputation[T]:
|
26
26
|
def __init__(self):
|
27
27
|
super().__init__()
|
28
28
|
self.dependencies = WeakSet[Subscribable]()
|
@@ -46,7 +46,7 @@ class BaseComputation:
|
|
46
46
|
def __exit__(self, *_):
|
47
47
|
self.dispose()
|
48
48
|
|
49
|
-
def trigger(self) ->
|
49
|
+
def trigger(self) -> T: ...
|
50
50
|
|
51
51
|
def __call__(self):
|
52
52
|
return self.trigger()
|
@@ -94,7 +94,7 @@ class State[T](Signal[T]):
|
|
94
94
|
state.set(value)
|
95
95
|
|
96
96
|
|
97
|
-
class Derived[T](BaseComputation):
|
97
|
+
class Derived[T](BaseComputation[T]):
|
98
98
|
def __init__(self, fn: Callable[[], T], auto_run=True):
|
99
99
|
super().__init__()
|
100
100
|
|
hmr-0.0.1.1.dist-info/RECORD
DELETED
@@ -1,9 +0,0 @@
|
|
1
|
-
hmr-0.0.1.1.dist-info/METADATA,sha256=Oy755jRMpZ9ySZqc8bLkbvA7esilABq5jkIV88BJgrg,230
|
2
|
-
hmr-0.0.1.1.dist-info/WHEEL,sha256=thaaA2w1JzcGC48WYufAs8nrYZjJm8LqNfnXFOFyCC4,90
|
3
|
-
hmr-0.0.1.1.dist-info/entry_points.txt,sha256=g_T0uJ43WgsdG14kkkdaBQuIL0HO-m1qvtjXMP6d060,59
|
4
|
-
reactivity/__init__.py,sha256=Stl2BBvqzutjcmF-O-olFTbSzJxzAl1xNMbu8mAVjlo,320
|
5
|
-
reactivity/functional.py,sha256=KAsqgPQsxIGuqO4BAtH6VF78MigLSBQ2k3aL4o_Vffg,1290
|
6
|
-
reactivity/helpers.py,sha256=xb3UThn7CGqJizCeing-vUBVZFwufadIEdWOgCFmuBo,3251
|
7
|
-
reactivity/hmr.py,sha256=h9ioWMhunyISVXXPBet9TxCrWKs1_JStKH1oUIWEN4g,7545
|
8
|
-
reactivity/primitives.py,sha256=7E99QLSblRfO3wPxRDpVqw8-KR2VI2g4QheShBXFv1g,3347
|
9
|
-
hmr-0.0.1.1.dist-info/RECORD,,
|
File without changes
|
File without changes
|