hmr 0.0.2.1__py3-none-any.whl → 0.0.2.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.
@@ -1,9 +1,9 @@
|
|
1
|
-
hmr-0.0.2.
|
2
|
-
hmr-0.0.2.
|
3
|
-
hmr-0.0.2.
|
1
|
+
hmr-0.0.2.2.dist-info/METADATA,sha256=NPJN4wTCpEC4ezd3q1P1I9zDb_DuwLTVNboN40j1BpI,230
|
2
|
+
hmr-0.0.2.2.dist-info/WHEEL,sha256=thaaA2w1JzcGC48WYufAs8nrYZjJm8LqNfnXFOFyCC4,90
|
3
|
+
hmr-0.0.2.2.dist-info/entry_points.txt,sha256=g_T0uJ43WgsdG14kkkdaBQuIL0HO-m1qvtjXMP6d060,59
|
4
4
|
reactivity/__init__.py,sha256=Stl2BBvqzutjcmF-O-olFTbSzJxzAl1xNMbu8mAVjlo,320
|
5
5
|
reactivity/functional.py,sha256=KAsqgPQsxIGuqO4BAtH6VF78MigLSBQ2k3aL4o_Vffg,1290
|
6
6
|
reactivity/helpers.py,sha256=auLTDFjfFc-cU9kVfm356GALW9lJIQ_UV7LGRZ2fWIw,3434
|
7
|
-
reactivity/hmr.py,sha256=
|
7
|
+
reactivity/hmr.py,sha256=GTYdj6XJLR_WErxUv6DaCxmkMLK5onKP1Qb9HzQxPBY,8002
|
8
8
|
reactivity/primitives.py,sha256=EIa_-5XOhffKw_lJ13EoAmFD3l0u_LFG1pJbODZSpMw,3351
|
9
|
-
hmr-0.0.2.
|
9
|
+
hmr-0.0.2.2.dist-info/RECORD,,
|
reactivity/hmr.py
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
import sys
|
2
|
-
from collections.abc import Iterable, Sequence
|
2
|
+
from collections.abc import Iterable, MutableMapping, Sequence
|
3
3
|
from contextlib import suppress
|
4
4
|
from functools import cached_property
|
5
5
|
from importlib.abc import Loader, MetaPathFinder
|
@@ -26,11 +26,25 @@ def is_called_in_this_file() -> bool:
|
|
26
26
|
return frame.f_globals.get("__file__") == __file__
|
27
27
|
|
28
28
|
|
29
|
+
class NamespaceProxy(Reactive):
|
30
|
+
def __init__(self, initial: MutableMapping, check_equality=True):
|
31
|
+
super().__init__(initial, check_equality)
|
32
|
+
self._original = initial
|
33
|
+
|
34
|
+
def __setitem__(self, key, value):
|
35
|
+
self._original[key] = value
|
36
|
+
return super().__setitem__(key, value)
|
37
|
+
|
38
|
+
def __delitem__(self, key):
|
39
|
+
del self._original[key]
|
40
|
+
return super().__delitem__(key)
|
41
|
+
|
42
|
+
|
29
43
|
class ReactiveModule(ModuleType):
|
30
44
|
def __init__(self, file: Path, namespace: dict, name: str, doc: str | None = None):
|
31
45
|
super().__init__(name, doc)
|
32
46
|
self.__namespace = namespace
|
33
|
-
self.__namespace_proxy =
|
47
|
+
self.__namespace_proxy = NamespaceProxy(namespace)
|
34
48
|
self.__file = file
|
35
49
|
|
36
50
|
@property
|
@@ -68,7 +82,6 @@ class ReactiveModuleLoader(Loader):
|
|
68
82
|
if self._is_package:
|
69
83
|
assert self._file.name == "__init__.py"
|
70
84
|
namespace["__path__"] = [str(self._file.parent.parent)]
|
71
|
-
namespace["__package__"] = spec.name
|
72
85
|
return ReactiveModule(self._file, namespace, spec.name)
|
73
86
|
|
74
87
|
def exec_module(self, module: ModuleType):
|
@@ -100,7 +113,7 @@ class ReactiveModuleFinder(MetaPathFinder):
|
|
100
113
|
return spec_from_loader(fullname, ReactiveModuleLoader(file), origin=str(file))
|
101
114
|
file = directory / f"{fullname.replace('.', '/')}/__init__.py"
|
102
115
|
if file.is_file() and all(not file.is_relative_to(exclude) for exclude in self.excludes):
|
103
|
-
return spec_from_loader(fullname, ReactiveModuleLoader(file, is_package=True), origin=str(file))
|
116
|
+
return spec_from_loader(fullname, ReactiveModuleLoader(file, is_package=True), origin=str(file), is_package=True)
|
104
117
|
|
105
118
|
|
106
119
|
def patch_module(name_or_module: str | ModuleType):
|
@@ -219,4 +232,4 @@ def cli():
|
|
219
232
|
SyncReloader(entry, excludes={".venv"}).keep_watching_until_interrupt()
|
220
233
|
|
221
234
|
|
222
|
-
__version__ = "0.0.2.
|
235
|
+
__version__ = "0.0.2.2"
|
File without changes
|
File without changes
|