wrapt 2.4.0__cp315-cp315-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 ADDED
@@ -0,0 +1,128 @@
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")
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 .exceptions import (
35
+ PathResolutionError,
36
+ TargetModuleNotFoundError,
37
+ WrapperChainTooDeepError,
38
+ WrapperNotFoundError,
39
+ WrapperNotInitializedError,
40
+ WrapperNotOutermostError,
41
+ )
42
+ from .importer import (
43
+ discover_post_import_hooks,
44
+ notify_module_loaded,
45
+ register_post_import_hook,
46
+ when_imported,
47
+ )
48
+ from .patches import (
49
+ MISSING,
50
+ AttributeWrapper,
51
+ apply_patch,
52
+ find_wrapper,
53
+ function_wrapper,
54
+ is_wrapped_by,
55
+ patch_function_wrapper,
56
+ resolve_owner,
57
+ resolve_path,
58
+ scoped_function_wrapper,
59
+ transient_function_wrapper,
60
+ unwrap_object,
61
+ unwrapped,
62
+ wrap_function_wrapper,
63
+ wrap_object,
64
+ wrap_object_attribute,
65
+ wrapper_chain,
66
+ )
67
+ from .proxies import AutoObjectProxy, LazyObjectProxy, ObjectProxy, lazy_import
68
+ from .signature import with_signature
69
+ from .synchronization import (
70
+ async_to_sync,
71
+ mark_as_async,
72
+ mark_as_sync,
73
+ sync_to_async,
74
+ synchronized,
75
+ )
76
+ from .weakrefs import WeakFunctionProxy
77
+
78
+ __all__ = (
79
+ "AutoObjectProxy",
80
+ "BaseObjectProxy",
81
+ "BoundFunctionWrapper",
82
+ "CallableObjectProxy",
83
+ "FunctionWrapper",
84
+ "LazyObjectProxy",
85
+ "ObjectProxy",
86
+ "PartialCallableObjectProxy",
87
+ "PathResolutionError",
88
+ "TargetModuleNotFoundError",
89
+ "WrapperChainTooDeepError",
90
+ "WrapperNotFoundError",
91
+ "WrapperNotInitializedError",
92
+ "WrapperNotOutermostError",
93
+ "partial",
94
+ "AdapterFactory",
95
+ "adapter_factory",
96
+ "bind_state_to_wrapper",
97
+ "async_to_sync",
98
+ "decorator",
99
+ "lru_cache",
100
+ "mark_as_async",
101
+ "mark_as_sync",
102
+ "sync_to_async",
103
+ "synchronized",
104
+ "with_signature",
105
+ "discover_post_import_hooks",
106
+ "notify_module_loaded",
107
+ "register_post_import_hook",
108
+ "when_imported",
109
+ "MISSING",
110
+ "AttributeWrapper",
111
+ "apply_patch",
112
+ "find_wrapper",
113
+ "function_wrapper",
114
+ "is_wrapped_by",
115
+ "lazy_import",
116
+ "patch_function_wrapper",
117
+ "resolve_owner",
118
+ "resolve_path",
119
+ "scoped_function_wrapper",
120
+ "transient_function_wrapper",
121
+ "unwrap_object",
122
+ "unwrapped",
123
+ "wrap_function_wrapper",
124
+ "wrap_object",
125
+ "wrap_object_attribute",
126
+ "wrapper_chain",
127
+ "WeakFunctionProxy",
128
+ )
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)