hmr 0.3.3.1__py3-none-any.whl → 0.3.3.3__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.3.3.1.dist-info → hmr-0.3.3.3.dist-info}/METADATA +1 -1
- {hmr-0.3.3.1.dist-info → hmr-0.3.3.3.dist-info}/RECORD +6 -6
- reactivity/hmr/core.py +8 -3
- reactivity/hmr/utils.py +6 -4
- {hmr-0.3.3.1.dist-info → hmr-0.3.3.3.dist-info}/WHEEL +0 -0
- {hmr-0.3.3.1.dist-info → hmr-0.3.3.3.dist-info}/entry_points.txt +0 -0
@@ -1,13 +1,13 @@
|
|
1
|
-
hmr-0.3.3.
|
2
|
-
hmr-0.3.3.
|
3
|
-
hmr-0.3.3.
|
1
|
+
hmr-0.3.3.3.dist-info/METADATA,sha256=TWN_VystOGF0zdKckjiayJus6XK7GJ-L03xlibtXs2E,260
|
2
|
+
hmr-0.3.3.3.dist-info/WHEEL,sha256=thaaA2w1JzcGC48WYufAs8nrYZjJm8LqNfnXFOFyCC4,90
|
3
|
+
hmr-0.3.3.3.dist-info/entry_points.txt,sha256=g_T0uJ43WgsdG14kkkdaBQuIL0HO-m1qvtjXMP6d060,59
|
4
4
|
reactivity/__init__.py,sha256=pX-RUzkezCC1x4eOWGxNhXbwrbvBLP_3pQuZr9eZz1Y,300
|
5
5
|
reactivity/functional.py,sha256=U06vshcVhZ0sb218gcmHtEhfgTNAGtQ7zyvPz2w5qKM,1292
|
6
6
|
reactivity/helpers.py,sha256=7gwsIKKrjEahSz9G9oR4s1LdYXQTCIMO0k4UGXGla9Y,3714
|
7
7
|
reactivity/hmr/__init__.py,sha256=S5ZIHqCRpevdzWuhS0aCua_S8F0LkK0YNg6IgeTScFQ,177
|
8
8
|
reactivity/hmr/api.py,sha256=-0-6Tn0AVkaDs7_qrCCd9TXxRTPDMDB08-UYfepTdec,1644
|
9
|
-
reactivity/hmr/core.py,sha256=
|
9
|
+
reactivity/hmr/core.py,sha256=TSbL1AMiel2eKzk23z1Sb8ruCTx9s5m6blbj0L9RGD4,10252
|
10
10
|
reactivity/hmr/hooks.py,sha256=-yLr5ktiyqPb1nDbHsgv6-c_ZkziBjNqCU-0PCfXGYU,592
|
11
|
-
reactivity/hmr/utils.py,sha256=
|
11
|
+
reactivity/hmr/utils.py,sha256=zM7X5I8ywOguOt20uE55INWOGen3FuJZDAvgouu7lI8,1550
|
12
12
|
reactivity/primitives.py,sha256=DR2waJbzhVKOioHXMliE4FIsxQUq7DZA0umPrlvchA4,4217
|
13
|
-
hmr-0.3.3.
|
13
|
+
hmr-0.3.3.3.dist-info/RECORD,,
|
reactivity/hmr/core.py
CHANGED
@@ -9,7 +9,8 @@ from inspect import currentframe
|
|
9
9
|
from pathlib import Path
|
10
10
|
from site import getsitepackages
|
11
11
|
from types import ModuleType, TracebackType
|
12
|
-
from typing import Any
|
12
|
+
from typing import Any, Self
|
13
|
+
from weakref import WeakValueDictionary
|
13
14
|
|
14
15
|
from .. import Reactive, batch, memoized_method
|
15
16
|
from .hooks import call_post_reload_hooks, call_pre_reload_hooks
|
@@ -43,6 +44,8 @@ class NamespaceProxy(Reactive[str, Any]):
|
|
43
44
|
|
44
45
|
|
45
46
|
class ReactiveModule(ModuleType):
|
47
|
+
instances: WeakValueDictionary[Path, Self] = WeakValueDictionary()
|
48
|
+
|
46
49
|
def __init__(self, file: Path, namespace: dict, name: str, doc: str | None = None):
|
47
50
|
super().__init__(name, doc)
|
48
51
|
self.__is_initialized = False
|
@@ -53,6 +56,8 @@ class ReactiveModule(ModuleType):
|
|
53
56
|
self.__namespace_proxy = NamespaceProxy(namespace)
|
54
57
|
self.__file = file
|
55
58
|
|
59
|
+
self.instances[file.resolve()] = self
|
60
|
+
|
56
61
|
@property
|
57
62
|
def file(self):
|
58
63
|
if is_called_in_this_file():
|
@@ -155,7 +160,7 @@ def patch_meta_path(includes: Iterable[str] = (".",), excludes: Iterable[str] =
|
|
155
160
|
|
156
161
|
|
157
162
|
def get_path_module_map():
|
158
|
-
return {
|
163
|
+
return {**ReactiveModule.instances}
|
159
164
|
|
160
165
|
|
161
166
|
class ErrorFilter:
|
@@ -307,4 +312,4 @@ def cli():
|
|
307
312
|
SyncReloader(entry).keep_watching_until_interrupt()
|
308
313
|
|
309
314
|
|
310
|
-
__version__ = "0.3.3.
|
315
|
+
__version__ = "0.3.3.3"
|
reactivity/hmr/utils.py
CHANGED
@@ -1,8 +1,8 @@
|
|
1
|
-
import sys
|
2
1
|
from collections import UserDict
|
3
2
|
from collections.abc import Callable
|
4
3
|
from functools import wraps
|
5
|
-
from inspect import getsource
|
4
|
+
from inspect import getsource, getsourcefile
|
5
|
+
from pathlib import Path
|
6
6
|
from types import FunctionType
|
7
7
|
|
8
8
|
from .. import create_memo
|
@@ -28,9 +28,11 @@ def clear_memos():
|
|
28
28
|
|
29
29
|
|
30
30
|
def cache_across_reloads[T](func: Callable[[], T]) -> Callable[[], T]:
|
31
|
-
|
31
|
+
file = getsourcefile(func)
|
32
|
+
assert file is not None
|
33
|
+
module = ReactiveModule.instances.get(Path(file).resolve())
|
32
34
|
|
33
|
-
if
|
35
|
+
if module is None:
|
34
36
|
from functools import cache
|
35
37
|
|
36
38
|
return cache(func) # type: ignore
|
File without changes
|
File without changes
|