wrapt 2.4.0.dev2__cp315-cp315t-win_arm64.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.
- wrapt/__init__.py +96 -0
- wrapt/__wrapt__.py +42 -0
- wrapt/_wrappers.c +5069 -0
- wrapt/_wrappers.cp315t-win_arm64.pyd +0 -0
- wrapt/arguments.py +55 -0
- wrapt/caching.py +234 -0
- wrapt/decorators.py +480 -0
- wrapt/importer.py +310 -0
- wrapt/patches.py +284 -0
- wrapt/proxies.py +370 -0
- wrapt/signature.py +250 -0
- wrapt/synchronization.py +475 -0
- wrapt/weakrefs.py +125 -0
- wrapt/wrappers.py +1120 -0
- wrapt-2.4.0.dev2.dist-info/METADATA +189 -0
- wrapt-2.4.0.dev2.dist-info/RECORD +20 -0
- wrapt-2.4.0.dev2.dist-info/WHEEL +5 -0
- wrapt-2.4.0.dev2.dist-info/licenses/LICENSE +24 -0
- wrapt-2.4.0.dev2.dist-info/top_level.txt +2 -0
- wrapt-stubs/__init__.pyi +702 -0
wrapt/__init__.py
ADDED
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Wrapt is a library for decorators, wrappers and monkey patching.
|
|
3
|
+
"""
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
def _format_version(parts):
|
|
7
|
+
base = ".".join(parts[:3])
|
|
8
|
+
if len(parts) == 3:
|
|
9
|
+
return base
|
|
10
|
+
suffix = parts[3]
|
|
11
|
+
return (
|
|
12
|
+
f"{base}.{suffix}" if suffix.startswith(("dev", "post")) else f"{base}{suffix}"
|
|
13
|
+
)
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
__version_info__ = ("2", "4", "0", "dev2")
|
|
17
|
+
__version__ = _format_version(__version_info__)
|
|
18
|
+
|
|
19
|
+
from .__wrapt__ import (
|
|
20
|
+
BaseObjectProxy,
|
|
21
|
+
BoundFunctionWrapper,
|
|
22
|
+
CallableObjectProxy,
|
|
23
|
+
FunctionWrapper,
|
|
24
|
+
PartialCallableObjectProxy,
|
|
25
|
+
partial,
|
|
26
|
+
)
|
|
27
|
+
from .caching import lru_cache
|
|
28
|
+
from .decorators import (
|
|
29
|
+
AdapterFactory,
|
|
30
|
+
adapter_factory,
|
|
31
|
+
bind_state_to_wrapper,
|
|
32
|
+
decorator,
|
|
33
|
+
)
|
|
34
|
+
from .importer import (
|
|
35
|
+
discover_post_import_hooks,
|
|
36
|
+
notify_module_loaded,
|
|
37
|
+
register_post_import_hook,
|
|
38
|
+
when_imported,
|
|
39
|
+
)
|
|
40
|
+
from .patches import (
|
|
41
|
+
apply_patch,
|
|
42
|
+
function_wrapper,
|
|
43
|
+
patch_function_wrapper,
|
|
44
|
+
resolve_path,
|
|
45
|
+
transient_function_wrapper,
|
|
46
|
+
wrap_function_wrapper,
|
|
47
|
+
wrap_object,
|
|
48
|
+
wrap_object_attribute,
|
|
49
|
+
)
|
|
50
|
+
from .proxies import AutoObjectProxy, LazyObjectProxy, ObjectProxy, lazy_import
|
|
51
|
+
from .signature import with_signature
|
|
52
|
+
from .synchronization import (
|
|
53
|
+
async_to_sync,
|
|
54
|
+
mark_as_async,
|
|
55
|
+
mark_as_sync,
|
|
56
|
+
sync_to_async,
|
|
57
|
+
synchronized,
|
|
58
|
+
)
|
|
59
|
+
from .weakrefs import WeakFunctionProxy
|
|
60
|
+
|
|
61
|
+
__all__ = (
|
|
62
|
+
"AutoObjectProxy",
|
|
63
|
+
"BaseObjectProxy",
|
|
64
|
+
"BoundFunctionWrapper",
|
|
65
|
+
"CallableObjectProxy",
|
|
66
|
+
"FunctionWrapper",
|
|
67
|
+
"LazyObjectProxy",
|
|
68
|
+
"ObjectProxy",
|
|
69
|
+
"PartialCallableObjectProxy",
|
|
70
|
+
"partial",
|
|
71
|
+
"AdapterFactory",
|
|
72
|
+
"adapter_factory",
|
|
73
|
+
"bind_state_to_wrapper",
|
|
74
|
+
"async_to_sync",
|
|
75
|
+
"decorator",
|
|
76
|
+
"lru_cache",
|
|
77
|
+
"mark_as_async",
|
|
78
|
+
"mark_as_sync",
|
|
79
|
+
"sync_to_async",
|
|
80
|
+
"synchronized",
|
|
81
|
+
"with_signature",
|
|
82
|
+
"discover_post_import_hooks",
|
|
83
|
+
"notify_module_loaded",
|
|
84
|
+
"register_post_import_hook",
|
|
85
|
+
"when_imported",
|
|
86
|
+
"apply_patch",
|
|
87
|
+
"function_wrapper",
|
|
88
|
+
"lazy_import",
|
|
89
|
+
"patch_function_wrapper",
|
|
90
|
+
"resolve_path",
|
|
91
|
+
"transient_function_wrapper",
|
|
92
|
+
"wrap_function_wrapper",
|
|
93
|
+
"wrap_object",
|
|
94
|
+
"wrap_object_attribute",
|
|
95
|
+
"WeakFunctionProxy",
|
|
96
|
+
)
|
wrapt/__wrapt__.py
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"""This module is used to switch between C and Python implementations of the
|
|
2
|
+
wrappers.
|
|
3
|
+
"""
|
|
4
|
+
|
|
5
|
+
import os
|
|
6
|
+
|
|
7
|
+
from .wrappers import BoundFunctionWrapper, CallableObjectProxy, FunctionWrapper
|
|
8
|
+
from .wrappers import ObjectProxy as BaseObjectProxy
|
|
9
|
+
from .wrappers import PartialCallableObjectProxy, _FunctionWrapperBase
|
|
10
|
+
|
|
11
|
+
# Try to use C extensions if not disabled.
|
|
12
|
+
|
|
13
|
+
_using_c_extension = False
|
|
14
|
+
|
|
15
|
+
_use_extensions = not os.environ.get("WRAPT_DISABLE_EXTENSIONS")
|
|
16
|
+
|
|
17
|
+
if _use_extensions:
|
|
18
|
+
try:
|
|
19
|
+
from ._wrappers import ( # type: ignore[no-redef,import-not-found,import-untyped]
|
|
20
|
+
BoundFunctionWrapper,
|
|
21
|
+
CallableObjectProxy,
|
|
22
|
+
FunctionWrapper,
|
|
23
|
+
)
|
|
24
|
+
from ._wrappers import ObjectProxy as BaseObjectProxy # type: ignore[no-redef,import-untyped]
|
|
25
|
+
from ._wrappers import ( # type: ignore[no-redef,import-not-found,import-untyped]
|
|
26
|
+
PartialCallableObjectProxy,
|
|
27
|
+
_FunctionWrapperBase,
|
|
28
|
+
)
|
|
29
|
+
|
|
30
|
+
_using_c_extension = True
|
|
31
|
+
except ImportError:
|
|
32
|
+
# C extensions not available, using Python implementations
|
|
33
|
+
pass
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
def partial(*args, **kwargs):
|
|
37
|
+
"""Create a callable object proxy with partial application of the given
|
|
38
|
+
arguments and keywords. This behaves the same as `functools.partial`, but
|
|
39
|
+
implemented using the `ObjectProxy` class to provide better support for
|
|
40
|
+
introspection.
|
|
41
|
+
"""
|
|
42
|
+
return PartialCallableObjectProxy(*args, **kwargs)
|