wrapt 2.4.0.dev2__cp315-cp315-win32.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.
@@ -0,0 +1,189 @@
1
+ Metadata-Version: 2.4
2
+ Name: wrapt
3
+ Version: 2.4.0.dev2
4
+ Summary: Module for decorators, wrappers and monkey patching.
5
+ Author-email: Graham Dumpleton <Graham.Dumpleton@gmail.com>
6
+ License-Expression: BSD-2-Clause
7
+ Project-URL: Homepage, https://github.com/GrahamDumpleton/wrapt
8
+ Project-URL: Bug Tracker, https://github.com/GrahamDumpleton/wrapt/issues/
9
+ Project-URL: Changelog, https://wrapt.readthedocs.io/en/latest/changes.html
10
+ Project-URL: Documentation, https://wrapt.readthedocs.io/
11
+ Keywords: wrapper,proxy,decorator
12
+ Classifier: Development Status :: 5 - Production/Stable
13
+ Classifier: Programming Language :: Python :: 3
14
+ Classifier: Programming Language :: Python :: 3.9
15
+ Classifier: Programming Language :: Python :: 3.10
16
+ Classifier: Programming Language :: Python :: 3.11
17
+ Classifier: Programming Language :: Python :: 3.12
18
+ Classifier: Programming Language :: Python :: 3.13
19
+ Classifier: Programming Language :: Python :: 3.14
20
+ Classifier: Programming Language :: Python :: 3.15
21
+ Classifier: Programming Language :: Python :: Implementation :: CPython
22
+ Classifier: Programming Language :: Python :: Implementation :: PyPy
23
+ Requires-Python: >=3.9
24
+ Description-Content-Type: text/x-rst
25
+ License-File: LICENSE
26
+ Provides-Extra: dev
27
+ Requires-Dist: pytest; extra == "dev"
28
+ Requires-Dist: setuptools; extra == "dev"
29
+ Dynamic: license-file
30
+
31
+ wrapt
32
+ =====
33
+
34
+ |PyPI| |Documentation|
35
+
36
+ A Python module for decorators, wrappers and monkey patching.
37
+
38
+ Overview
39
+ --------
40
+
41
+ The **wrapt** module provides a transparent object proxy for Python, which can be used as the basis for the construction of function wrappers and decorator functions.
42
+
43
+ The **wrapt** module focuses very much on correctness. It goes way beyond existing mechanisms such as ``functools.wraps()`` to ensure that decorators preserve introspectability, signatures, type checking abilities etc. The decorators that can be constructed using this module will work in far more scenarios than typical decorators and provide more predictable and consistent behaviour.
44
+
45
+ To ensure that the overhead is as minimal as possible, a C extension module is used for performance critical components. An automatic fallback to a pure Python implementation is also provided where a target system does not have a compiler to allow the C extension to be compiled.
46
+
47
+ Key Features
48
+ ------------
49
+
50
+ * **Universal decorators** that work with functions, methods, classmethods, staticmethods, and classes
51
+ * **Transparent object proxies** for advanced wrapping scenarios
52
+ * **Monkey patching utilities** for safe runtime modifications
53
+ * **C extension** for optimal performance with Python fallback
54
+ * **Comprehensive introspection preservation** (signatures, annotations, etc.)
55
+ * **Thread-safe decorator implementations**
56
+
57
+ Installation
58
+ ------------
59
+
60
+ Install from PyPI using pip::
61
+
62
+ pip install wrapt
63
+
64
+ Supported Python Versions
65
+ --------------------------
66
+
67
+ * Python 3.9+
68
+ * CPython and PyPy implementations
69
+
70
+ Documentation
71
+ -------------
72
+
73
+ For comprehensive documentation, examples, and advanced usage patterns, visit:
74
+
75
+ * https://wrapt.readthedocs.io/
76
+
77
+ Quick Start
78
+ -----------
79
+
80
+ To implement your decorator you need to first define a wrapper function.
81
+ This will be called each time a decorated function is called. The wrapper
82
+ function needs to take four positional arguments:
83
+
84
+ * ``wrapped`` - The wrapped function which in turns needs to be called by your wrapper function.
85
+ * ``instance`` - The object to which the wrapped function was bound when it was called.
86
+ * ``args`` - The list of positional arguments supplied when the decorated function was called.
87
+ * ``kwargs`` - The dictionary of keyword arguments supplied when the decorated function was called.
88
+
89
+ The wrapper function would do whatever it needs to, but would usually in
90
+ turn call the wrapped function that is passed in via the ``wrapped``
91
+ argument.
92
+
93
+ The decorator ``@wrapt.decorator`` then needs to be applied to the wrapper
94
+ function to convert it into a decorator which can in turn be applied to
95
+ other functions.
96
+
97
+ .. code-block:: python
98
+
99
+ import wrapt
100
+
101
+ @wrapt.decorator
102
+ def pass_through(wrapped, instance, args, kwargs):
103
+ return wrapped(*args, **kwargs)
104
+
105
+ @pass_through
106
+ def function():
107
+ pass
108
+
109
+ If you wish to implement a decorator which accepts arguments, then wrap the
110
+ definition of the decorator in a function closure. Any arguments supplied
111
+ to the outer function when the decorator is applied, will be available to
112
+ the inner wrapper when the wrapped function is called.
113
+
114
+ .. code-block:: python
115
+
116
+ import wrapt
117
+
118
+ def with_arguments(myarg1, myarg2):
119
+ @wrapt.decorator
120
+ def wrapper(wrapped, instance, args, kwargs):
121
+ return wrapped(*args, **kwargs)
122
+ return wrapper
123
+
124
+ @with_arguments(1, 2)
125
+ def function():
126
+ pass
127
+
128
+ When applied to a normal function or static method, the wrapper function
129
+ when called will be passed ``None`` as the ``instance`` argument.
130
+
131
+ When applied to an instance method, the wrapper function when called will
132
+ be passed the instance of the class the method is being called on as the
133
+ ``instance`` argument. This will be the case even when the instance method
134
+ was called explicitly via the class and the instance passed as the first
135
+ argument. That is, the instance will never be passed as part of ``args``.
136
+
137
+ When applied to a class method, the wrapper function when called will be
138
+ passed the class type as the ``instance`` argument.
139
+
140
+ When applied to a class, the wrapper function when called will be passed
141
+ ``None`` as the ``instance`` argument. The ``wrapped`` argument in this
142
+ case will be the class.
143
+
144
+ The above rules can be summarised with the following example.
145
+
146
+ .. code-block:: python
147
+
148
+ import inspect
149
+
150
+ @wrapt.decorator
151
+ def universal(wrapped, instance, args, kwargs):
152
+ if instance is None:
153
+ if inspect.isclass(wrapped):
154
+ # Decorator was applied to a class.
155
+ return wrapped(*args, **kwargs)
156
+ else:
157
+ # Decorator was applied to a function or staticmethod.
158
+ return wrapped(*args, **kwargs)
159
+ else:
160
+ if inspect.isclass(instance):
161
+ # Decorator was applied to a classmethod.
162
+ return wrapped(*args, **kwargs)
163
+ else:
164
+ # Decorator was applied to an instancemethod.
165
+ return wrapped(*args, **kwargs)
166
+
167
+ Using these checks it is therefore possible to create a universal decorator
168
+ that can be applied in all situations. It is no longer necessary to create
169
+ different variants of decorators for normal functions and instance methods,
170
+ or use additional wrappers to convert a function decorator into one that
171
+ will work for instance methods.
172
+
173
+ In all cases, the wrapped function passed to the wrapper function is called
174
+ in the same way, with ``args`` and ``kwargs`` being passed. The
175
+ ``instance`` argument doesn't need to be used in calling the wrapped
176
+ function.
177
+
178
+ Links
179
+ -----
180
+
181
+ * **Documentation**: https://wrapt.readthedocs.io/
182
+ * **Source Code**: https://github.com/GrahamDumpleton/wrapt
183
+ * **Bug Reports**: https://github.com/GrahamDumpleton/wrapt/issues/
184
+ * **Changelog**: https://wrapt.readthedocs.io/en/latest/changes.html
185
+
186
+ .. |PyPI| image:: https://img.shields.io/pypi/v/wrapt.svg?logo=python&cacheSeconds=3600
187
+ :target: https://pypi.python.org/pypi/wrapt
188
+ .. |Documentation| image:: https://img.shields.io/badge/docs-wrapt.readthedocs.io-blue.svg
189
+ :target: https://wrapt.readthedocs.io/
@@ -0,0 +1,20 @@
1
+ wrapt/__init__.py,sha256=wbvz3e5Q8a43YDlOWF6BmfK6P3iyHqyaEEF7s7-XCb4,2262
2
+ wrapt/__wrapt__.py,sha256=D_4vsXDYrUnffMsVprVRW66hhbOgGxeZwDJXN0pd5SQ,1476
3
+ wrapt/_wrappers.c,sha256=oXDk-eR47eQ2Vltv2fFRGB7MAX6h6B1LQUX_GBA8eHc,137615
4
+ wrapt/_wrappers.cp315-win32.pyd,sha256=A75CBGwqs5LFZ_iooE_gUCX5WMTDMwZLwjthHfi4_6E,43008
5
+ wrapt/arguments.py,sha256=RRmw2k_SrPAmg36gbRx6-biMyh8PmaL6xyLvvWjycLE,2324
6
+ wrapt/caching.py,sha256=g19mdrJL0xEOMZIcB6XfZCDxdwnBKBOvNqZddWDhdiI,9124
7
+ wrapt/decorators.py,sha256=ObpLT631B7Uy8ZaVYxWohw6POZearOktZZICcDGmobc,19378
8
+ wrapt/importer.py,sha256=sWIRK4yEuuB_DKlicgK6qY2U6EtsEL_dCPhpM0UEexM,12089
9
+ wrapt/patches.py,sha256=ylzWQS2vdzuJmR2h5-VsRefKxwibcqdq2KRogiv8LZ8,11879
10
+ wrapt/proxies.py,sha256=21Oh3IBdAQ0tA3Eg-vSEz4ICGqYdi4tvrqmrzQaSTZ8,13705
11
+ wrapt/signature.py,sha256=NHvjj4TZ5tv5MoTH3qSi6MNU06EFW80IHLextqqATSk,8776
12
+ wrapt/synchronization.py,sha256=YxwY46pSOWP6Ns5ULa0Ee3KcFv1DB-kdM9tfGOuSIH8,18685
13
+ wrapt/weakrefs.py,sha256=H1Ca2WqZXvtZyVRlTzMNMv4zlJIWYw0_J25ki1Yq2TQ,5362
14
+ wrapt/wrappers.py,sha256=WEjRIO0nmoqR3t5KNjuCAurJH22cvH_DEuG5EOVzAjs,41155
15
+ wrapt-2.4.0.dev2.dist-info/licenses/LICENSE,sha256=_Fr7gpM6wYQ69WLcNDeSaH6KUTBYqq_7ddirpUkqcFA,1328
16
+ wrapt-stubs/__init__.pyi,sha256=IoC1djv2AaPr9rejUl5RXQa48dK1b4AslR_WGfgNIxU,26950
17
+ wrapt-2.4.0.dev2.dist-info/METADATA,sha256=HwABE3C-4jquPK4d8XtMRiRkM-6sE8259TnnbFsI3ec,7610
18
+ wrapt-2.4.0.dev2.dist-info/WHEEL,sha256=p-FSH-udqXPVp_21nPd73avr9B5YvzZmONZbnHUQ1IA,97
19
+ wrapt-2.4.0.dev2.dist-info/top_level.txt,sha256=jbmK9ImKGnBFpDeCpR4Qgh4XAf-gsbqzRtKn2sW4JQg,18
20
+ wrapt-2.4.0.dev2.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (83.0.0)
3
+ Root-Is-Purelib: false
4
+ Tag: cp315-cp315-win32
5
+
@@ -0,0 +1,24 @@
1
+ Copyright (c) 2013-2026, Graham Dumpleton
2
+ All rights reserved.
3
+
4
+ Redistribution and use in source and binary forms, with or without
5
+ modification, are permitted provided that the following conditions are met:
6
+
7
+ * Redistributions of source code must retain the above copyright notice, this
8
+ list of conditions and the following disclaimer.
9
+
10
+ * Redistributions in binary form must reproduce the above copyright notice,
11
+ this list of conditions and the following disclaimer in the documentation
12
+ and/or other materials provided with the distribution.
13
+
14
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
15
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
18
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
19
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
20
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
21
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
22
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
23
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
24
+ POSSIBILITY OF SUCH DAMAGE.
@@ -0,0 +1,2 @@
1
+ wrapt
2
+ wrapt-stubs