python-dispatch 0.2.3__py3-none-any.whl → 0.2.41__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.
- pydispatch/decorators.py +8 -9
- pydispatch/properties.py +6 -2
- pydispatch/utils.py +2 -1
- {python_dispatch-0.2.3.dist-info → python_dispatch-0.2.41.dist-info}/METADATA +9 -13
- python_dispatch-0.2.41.dist-info/RECORD +9 -0
- {python_dispatch-0.2.3.dist-info → python_dispatch-0.2.41.dist-info}/WHEEL +2 -2
- python_dispatch-0.2.3.dist-info/RECORD +0 -9
pydispatch/decorators.py
CHANGED
|
@@ -124,12 +124,11 @@ def _post_register_hook(*names):
|
|
|
124
124
|
"""Called in :func:`pydispatch.register_event` to search for cached callbacks
|
|
125
125
|
"""
|
|
126
126
|
for name in names:
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
pydispatch.bind(**bind_kwargs)
|
|
127
|
+
loop = None
|
|
128
|
+
for callback in _CACHED_CALLBACKS.get(name):
|
|
129
|
+
if iscoroutinefunction(callback):
|
|
130
|
+
if loop is None:
|
|
131
|
+
loop = asyncio.get_event_loop()
|
|
132
|
+
pydispatch.bind_async(loop, **{name: callback})
|
|
133
|
+
else:
|
|
134
|
+
pydispatch.bind(**{name: callback})
|
pydispatch/properties.py
CHANGED
|
@@ -331,10 +331,14 @@ class ObservableDict(dict, Observable):
|
|
|
331
331
|
super(ObservableDict, self).clear()
|
|
332
332
|
self._emit_change(old=old)
|
|
333
333
|
def pop(self, *args):
|
|
334
|
+
"""Return the removed value or default after emitting a change event."""
|
|
334
335
|
old = self._get_copy_or_none()
|
|
335
|
-
super(ObservableDict, self).pop(*args)
|
|
336
|
+
value = super(ObservableDict, self).pop(*args)
|
|
336
337
|
self._emit_change(old=old)
|
|
338
|
+
return value
|
|
337
339
|
def setdefault(self, *args):
|
|
340
|
+
"""Return the existing or inserted value and notify on successful calls."""
|
|
338
341
|
old = self._get_copy_or_none()
|
|
339
|
-
super(ObservableDict, self).setdefault(*args)
|
|
342
|
+
value = super(ObservableDict, self).setdefault(*args)
|
|
340
343
|
self._emit_change(old=old)
|
|
344
|
+
return value
|
pydispatch/utils.py
CHANGED
|
@@ -3,6 +3,7 @@ from weakref import ref
|
|
|
3
3
|
from _weakref import _remove_dead_weakref # type: ignore[import]
|
|
4
4
|
import types
|
|
5
5
|
import asyncio
|
|
6
|
+
import inspect
|
|
6
7
|
|
|
7
8
|
def get_method_vars(m):
|
|
8
9
|
f = m.__func__
|
|
@@ -13,7 +14,7 @@ def isfunction(m):
|
|
|
13
14
|
return isinstance(m, types.FunctionType)
|
|
14
15
|
|
|
15
16
|
def iscoroutinefunction(obj):
|
|
16
|
-
return
|
|
17
|
+
return inspect.iscoroutinefunction(obj)
|
|
17
18
|
|
|
18
19
|
class WeakMethodContainer(weakref.WeakValueDictionary):
|
|
19
20
|
"""Container to store weak references to callbacks
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: python-dispatch
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.41
|
|
4
4
|
Summary: Lightweight Event Handling Library for Python
|
|
5
5
|
Keywords: event,properties,dispatch
|
|
6
6
|
Author: Matthew Reid
|
|
@@ -12,20 +12,16 @@ Classifier: Operating System :: OS Independent
|
|
|
12
12
|
Classifier: Programming Language :: Python
|
|
13
13
|
Classifier: Topic :: Software Development
|
|
14
14
|
Classifier: Programming Language :: Python :: 3
|
|
15
|
-
Classifier: Programming Language :: Python :: 3.8
|
|
16
|
-
Classifier: Programming Language :: Python :: 3.9
|
|
17
|
-
Classifier: Programming Language :: Python :: 3.10
|
|
18
15
|
Classifier: Programming Language :: Python :: 3.11
|
|
19
16
|
Classifier: Programming Language :: Python :: 3.12
|
|
20
17
|
Classifier: Programming Language :: Python :: 3.13
|
|
21
18
|
Classifier: Programming Language :: Python :: 3.14
|
|
22
19
|
Classifier: Topic :: Software Development :: Libraries
|
|
23
20
|
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
24
|
-
Requires-
|
|
25
|
-
Requires-Python: >=3.8
|
|
21
|
+
Requires-Python: >=3.11
|
|
26
22
|
Project-URL: Documentation, https://python-dispatch.readthedocs.io/
|
|
27
|
-
Project-URL: Download, https://pypi.org/project/python-dispatch/
|
|
28
23
|
Project-URL: Source, https://github.com/nocarryr/python-dispatch
|
|
24
|
+
Project-URL: Download, https://pypi.org/project/python-dispatch/
|
|
29
25
|
Project-URL: Tracker, https://github.com/nocarryr/python-dispatch/issues
|
|
30
26
|
Description-Content-Type: text/markdown
|
|
31
27
|
|
|
@@ -36,7 +32,7 @@ Lightweight event handling for Python
|
|
|
36
32
|
|
|
37
33
|
## Description
|
|
38
34
|
This is an implementation of the "Observer Pattern" with inspiration from the
|
|
39
|
-
[Kivy](kivy.org) framework. Many of the features though are intentionally
|
|
35
|
+
[Kivy](https://kivy.org) framework. Many of the features though are intentionally
|
|
40
36
|
stripped down and more generalized. The goal is to have a simple drop-in
|
|
41
37
|
library with no dependencies that stays out of the programmer's way.
|
|
42
38
|
|
|
@@ -68,9 +64,9 @@ pip install python-dispatch<0.2
|
|
|
68
64
|
|
|
69
65
|
| | |
|
|
70
66
|
| -------------:|:-------------------------------------------- |
|
|
71
|
-
| Project Home | https://github.com/nocarryr/python-dispatch
|
|
72
|
-
| PyPI | https://pypi.python.org/pypi/python-dispatch |
|
|
73
|
-
| Documentation | https://python-dispatch.readthedocs.io
|
|
67
|
+
| Project Home | [https://github.com/nocarryr/python-dispatch](https://github.com/nocarryr/python-dispatch) |
|
|
68
|
+
| PyPI | [https://pypi.python.org/pypi/python-dispatch](https://pypi.python.org/pypi/python-dispatch) |
|
|
69
|
+
| Documentation | [https://python-dispatch.readthedocs.io](https://python-dispatch.readthedocs.io) |
|
|
74
70
|
|
|
75
71
|
|
|
76
72
|
## Usage
|
|
@@ -149,9 +145,9 @@ emitter value is 42
|
|
|
149
145
|
Contributions are welcome!
|
|
150
146
|
|
|
151
147
|
If you want to contribute through code or documentation, please see the
|
|
152
|
-
[Contributing Guide](CONTRIBUTING.md) for information.
|
|
148
|
+
[Contributing Guide](https://github.com/nocarryr/python-dispatch/blob/master/CONTRIBUTING.md) for information.
|
|
153
149
|
|
|
154
150
|
## License
|
|
155
151
|
|
|
156
|
-
This project is released under the MIT License. See the [LICENSE](LICENSE.txt) file
|
|
152
|
+
This project is released under the MIT License. See the [LICENSE](https://github.com/nocarryr/python-dispatch/blob/master/LICENSE.txt) file
|
|
157
153
|
for more information.
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
pydispatch/__init__.py,sha256=qt4QDOYq_QGq0bMZizAvnhhzLr7LkZe9PBHilTjc74Y,2190
|
|
2
|
+
pydispatch/aioutils.py,sha256=tv-ddi8tMwqtOJGNqONYb2Y-PKXyOJG4wsX3EzmgBsw,9848
|
|
3
|
+
pydispatch/decorators.py,sha256=MJaRKu3lziYSMLAIpFAgsAcLoSLlbRyWHoioSDKgRKM,4160
|
|
4
|
+
pydispatch/dispatch.py,sha256=Jbb7bl7kdsXlfQsCM8Jehui7qpSH1GhawEgPLk-lyAo,13508
|
|
5
|
+
pydispatch/properties.py,sha256=15krCVGV17lUi9VG2ZyEZvz3AxoQ385IBoLqHmBKPSM,13361
|
|
6
|
+
pydispatch/utils.py,sha256=S50sMdx32YYthvCRRwV1ivdwtw7xXmopozy3aLDypa0,6550
|
|
7
|
+
python_dispatch-0.2.41.dist-info/WHEEL,sha256=MWx7psoF7KNST9G72pGtiBYuaXRXQXBk9pw5R6FzYko,80
|
|
8
|
+
python_dispatch-0.2.41.dist-info/METADATA,sha256=CE9c463Vl195iRe52nu2MVUUH_7Nc6vkb9Ee3T0HFFI,5839
|
|
9
|
+
python_dispatch-0.2.41.dist-info/RECORD,,
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
pydispatch/__init__.py,sha256=qt4QDOYq_QGq0bMZizAvnhhzLr7LkZe9PBHilTjc74Y,2190
|
|
2
|
-
pydispatch/aioutils.py,sha256=tv-ddi8tMwqtOJGNqONYb2Y-PKXyOJG4wsX3EzmgBsw,9848
|
|
3
|
-
pydispatch/decorators.py,sha256=FFts0T9wvTVAgC9KGZSkpn_Nneecl1gAzufgP6nI4iQ,4213
|
|
4
|
-
pydispatch/dispatch.py,sha256=Jbb7bl7kdsXlfQsCM8Jehui7qpSH1GhawEgPLk-lyAo,13508
|
|
5
|
-
pydispatch/properties.py,sha256=Pt4J32bqz3xT5BwmIO3Idl8vmkNbei2R0g_Vqwi7RH0,13138
|
|
6
|
-
pydispatch/utils.py,sha256=ubuGYHi0rxNS_Dbhqftfyr6yANS0OlaB6Ni9_x_kEP4,6535
|
|
7
|
-
python_dispatch-0.2.3.dist-info/WHEEL,sha256=ZyFSCYkV2BrxH6-HRVRg3R9Fo7MALzer9KiPYqNxSbo,79
|
|
8
|
-
python_dispatch-0.2.3.dist-info/METADATA,sha256=S1e1HF_lMN-gVv80kfCMUgbLVTNtLNslwkaW1A6NMsA,5802
|
|
9
|
-
python_dispatch-0.2.3.dist-info/RECORD,,
|