zstdlib 0.10.11__tar.gz → 0.10.12__tar.gz
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.
- {zstdlib-0.10.11 → zstdlib-0.10.12}/PKG-INFO +1 -1
- {zstdlib-0.10.11 → zstdlib-0.10.12}/zstdlib/__init__.py +1 -1
- {zstdlib-0.10.11 → zstdlib-0.10.12}/zstdlib/hybridmethod.py +5 -2
- {zstdlib-0.10.11 → zstdlib-0.10.12}/zstdlib.egg-info/PKG-INFO +1 -1
- {zstdlib-0.10.11 → zstdlib-0.10.12}/LICENSE +0 -0
- {zstdlib-0.10.11 → zstdlib-0.10.12}/README.md +0 -0
- {zstdlib-0.10.11 → zstdlib-0.10.12}/pyproject.toml +0 -0
- {zstdlib-0.10.11 → zstdlib-0.10.12}/setup.cfg +0 -0
- {zstdlib-0.10.11 → zstdlib-0.10.12}/tests/__init__.py +0 -0
- {zstdlib-0.10.11 → zstdlib-0.10.12}/tests/log/__init__.py +0 -0
- {zstdlib-0.10.11 → zstdlib-0.10.12}/tests/log/base.py +0 -0
- {zstdlib-0.10.11 → zstdlib-0.10.12}/tests/log/test_cute.py +0 -0
- {zstdlib-0.10.11 → zstdlib-0.10.12}/tests/log/test_trace.py +0 -0
- {zstdlib-0.10.11 → zstdlib-0.10.12}/tests/test_ansi.py +0 -0
- {zstdlib-0.10.11 → zstdlib-0.10.12}/tests/test_enum.py +0 -0
- {zstdlib-0.10.11 → zstdlib-0.10.12}/tests/test_exc_capture.py +0 -0
- {zstdlib-0.10.11 → zstdlib-0.10.12}/tests/test_frozen.py +0 -0
- {zstdlib-0.10.11 → zstdlib-0.10.12}/tests/test_hybridmethod.py +0 -0
- {zstdlib-0.10.11 → zstdlib-0.10.12}/tests/test_io.py +0 -0
- {zstdlib-0.10.11 → zstdlib-0.10.12}/tests/test_ip_lock.py +0 -0
- {zstdlib-0.10.11 → zstdlib-0.10.12}/tests/test_keyed_instance.py +0 -0
- {zstdlib-0.10.11 → zstdlib-0.10.12}/tests/test_lazy.py +0 -0
- {zstdlib-0.10.11 → zstdlib-0.10.12}/tests/test_not_set.py +0 -0
- {zstdlib-0.10.11 → zstdlib-0.10.12}/tests/test_prompt.py +0 -0
- {zstdlib-0.10.11 → zstdlib-0.10.12}/tests/test_singleton.py +0 -0
- {zstdlib-0.10.11 → zstdlib-0.10.12}/tests/test_util.py +0 -0
- {zstdlib-0.10.11 → zstdlib-0.10.12}/zstdlib/ansi.py +0 -0
- {zstdlib-0.10.11 → zstdlib-0.10.12}/zstdlib/enum.py +0 -0
- {zstdlib-0.10.11 → zstdlib-0.10.12}/zstdlib/exc_capture.py +0 -0
- {zstdlib-0.10.11 → zstdlib-0.10.12}/zstdlib/frozen.py +0 -0
- {zstdlib-0.10.11 → zstdlib-0.10.12}/zstdlib/io.py +0 -0
- {zstdlib-0.10.11 → zstdlib-0.10.12}/zstdlib/ip_lock.py +0 -0
- {zstdlib-0.10.11 → zstdlib-0.10.12}/zstdlib/keyed_instance.py +0 -0
- {zstdlib-0.10.11 → zstdlib-0.10.12}/zstdlib/lazy.py +0 -0
- {zstdlib-0.10.11 → zstdlib-0.10.12}/zstdlib/log/__init__.py +0 -0
- {zstdlib-0.10.11 → zstdlib-0.10.12}/zstdlib/log/cute.py +0 -0
- {zstdlib-0.10.11 → zstdlib-0.10.12}/zstdlib/log/trace.py +0 -0
- {zstdlib-0.10.11 → zstdlib-0.10.12}/zstdlib/macos.py +0 -0
- {zstdlib-0.10.11 → zstdlib-0.10.12}/zstdlib/not_set.py +0 -0
- {zstdlib-0.10.11 → zstdlib-0.10.12}/zstdlib/prompt.py +0 -0
- {zstdlib-0.10.11 → zstdlib-0.10.12}/zstdlib/py.typed +0 -0
- {zstdlib-0.10.11 → zstdlib-0.10.12}/zstdlib/signal_cm.py +0 -0
- {zstdlib-0.10.11 → zstdlib-0.10.12}/zstdlib/singleton.py +0 -0
- {zstdlib-0.10.11 → zstdlib-0.10.12}/zstdlib/util.py +0 -0
- {zstdlib-0.10.11 → zstdlib-0.10.12}/zstdlib.egg-info/SOURCES.txt +0 -0
- {zstdlib-0.10.11 → zstdlib-0.10.12}/zstdlib.egg-info/dependency_links.txt +0 -0
- {zstdlib-0.10.11 → zstdlib-0.10.12}/zstdlib.egg-info/requires.txt +0 -0
- {zstdlib-0.10.11 → zstdlib-0.10.12}/zstdlib.egg-info/top_level.txt +0 -0
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
from typing import Concatenate, overload
|
|
2
2
|
from collections.abc import Callable
|
|
3
|
+
from functools import wraps
|
|
3
4
|
|
|
4
5
|
__all__ = ("hybridmethod",)
|
|
5
6
|
|
|
@@ -12,13 +13,14 @@ class hybridmethod[T, R, **P]: # Name aligns with @staticmethod and such
|
|
|
12
13
|
A member function decorator that combines an instances bound function and @classmethod
|
|
13
14
|
If a member function uses @hybridmethod then it may use the signature:
|
|
14
15
|
@hybridmethod
|
|
15
|
-
def f(self:
|
|
16
|
+
def f(self: Foo | None, cls: type[Foo], ...)
|
|
16
17
|
This could be used to implement functions such as:
|
|
17
|
-
def history(self:
|
|
18
|
+
def history(self: Foo | None, cls: type[Foo], *, id: int | None = None): ...
|
|
18
19
|
...
|
|
19
20
|
A.history(id=a.id)
|
|
20
21
|
A.history(id=0)
|
|
21
22
|
a.history()
|
|
23
|
+
Note that using Self is the type signature is invalid, just as it is with @classmethod
|
|
22
24
|
"""
|
|
23
25
|
|
|
24
26
|
__slots__ = ("_fn",)
|
|
@@ -39,6 +41,7 @@ class hybridmethod[T, R, **P]: # Name aligns with @staticmethod and such
|
|
|
39
41
|
owner = type(instance)
|
|
40
42
|
|
|
41
43
|
# functools.partial doesn't preserve typing as we need it to :/
|
|
44
|
+
@wraps(self._fn)
|
|
42
45
|
def ret(*args: P.args, **kwargs: P.kwargs) -> R:
|
|
43
46
|
return self._fn(instance, owner, *args, **kwargs)
|
|
44
47
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|