wrapt 2.1.0.dev1__cp313-cp313t-musllinux_1_2_x86_64.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,188 @@
1
+ Metadata-Version: 2.4
2
+ Name: wrapt
3
+ Version: 2.1.0.dev1
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 :: Implementation :: CPython
21
+ Classifier: Programming Language :: Python :: Implementation :: PyPy
22
+ Requires-Python: >=3.9
23
+ Description-Content-Type: text/x-rst
24
+ License-File: LICENSE
25
+ Provides-Extra: dev
26
+ Requires-Dist: pytest; extra == "dev"
27
+ Requires-Dist: setuptools; extra == "dev"
28
+ Dynamic: license-file
29
+
30
+ wrapt
31
+ =====
32
+
33
+ |PyPI| |Documentation|
34
+
35
+ A Python module for decorators, wrappers and monkey patching.
36
+
37
+ Overview
38
+ --------
39
+
40
+ 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.
41
+
42
+ 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.
43
+
44
+ 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.
45
+
46
+ Key Features
47
+ ------------
48
+
49
+ * **Universal decorators** that work with functions, methods, classmethods, staticmethods, and classes
50
+ * **Transparent object proxies** for advanced wrapping scenarios
51
+ * **Monkey patching utilities** for safe runtime modifications
52
+ * **C extension** for optimal performance with Python fallback
53
+ * **Comprehensive introspection preservation** (signatures, annotations, etc.)
54
+ * **Thread-safe decorator implementations**
55
+
56
+ Installation
57
+ ------------
58
+
59
+ Install from PyPI using pip::
60
+
61
+ pip install wrapt
62
+
63
+ Supported Python Versions
64
+ --------------------------
65
+
66
+ * Python 3.9+
67
+ * CPython and PyPy implementations
68
+
69
+ Documentation
70
+ -------------
71
+
72
+ For comprehensive documentation, examples, and advanced usage patterns, visit:
73
+
74
+ * https://wrapt.readthedocs.io/
75
+
76
+ Quick Start
77
+ -----------
78
+
79
+ To implement your decorator you need to first define a wrapper function.
80
+ This will be called each time a decorated function is called. The wrapper
81
+ function needs to take four positional arguments:
82
+
83
+ * ``wrapped`` - The wrapped function which in turns needs to be called by your wrapper function.
84
+ * ``instance`` - The object to which the wrapped function was bound when it was called.
85
+ * ``args`` - The list of positional arguments supplied when the decorated function was called.
86
+ * ``kwargs`` - The dictionary of keyword arguments supplied when the decorated function was called.
87
+
88
+ The wrapper function would do whatever it needs to, but would usually in
89
+ turn call the wrapped function that is passed in via the ``wrapped``
90
+ argument.
91
+
92
+ The decorator ``@wrapt.decorator`` then needs to be applied to the wrapper
93
+ function to convert it into a decorator which can in turn be applied to
94
+ other functions.
95
+
96
+ .. code-block:: python
97
+
98
+ import wrapt
99
+
100
+ @wrapt.decorator
101
+ def pass_through(wrapped, instance, args, kwargs):
102
+ return wrapped(*args, **kwargs)
103
+
104
+ @pass_through
105
+ def function():
106
+ pass
107
+
108
+ If you wish to implement a decorator which accepts arguments, then wrap the
109
+ definition of the decorator in a function closure. Any arguments supplied
110
+ to the outer function when the decorator is applied, will be available to
111
+ the inner wrapper when the wrapped function is called.
112
+
113
+ .. code-block:: python
114
+
115
+ import wrapt
116
+
117
+ def with_arguments(myarg1, myarg2):
118
+ @wrapt.decorator
119
+ def wrapper(wrapped, instance, args, kwargs):
120
+ return wrapped(*args, **kwargs)
121
+ return wrapper
122
+
123
+ @with_arguments(1, 2)
124
+ def function():
125
+ pass
126
+
127
+ When applied to a normal function or static method, the wrapper function
128
+ when called will be passed ``None`` as the ``instance`` argument.
129
+
130
+ When applied to an instance method, the wrapper function when called will
131
+ be passed the instance of the class the method is being called on as the
132
+ ``instance`` argument. This will be the case even when the instance method
133
+ was called explicitly via the class and the instance passed as the first
134
+ argument. That is, the instance will never be passed as part of ``args``.
135
+
136
+ When applied to a class method, the wrapper function when called will be
137
+ passed the class type as the ``instance`` argument.
138
+
139
+ When applied to a class, the wrapper function when called will be passed
140
+ ``None`` as the ``instance`` argument. The ``wrapped`` argument in this
141
+ case will be the class.
142
+
143
+ The above rules can be summarised with the following example.
144
+
145
+ .. code-block:: python
146
+
147
+ import inspect
148
+
149
+ @wrapt.decorator
150
+ def universal(wrapped, instance, args, kwargs):
151
+ if instance is None:
152
+ if inspect.isclass(wrapped):
153
+ # Decorator was applied to a class.
154
+ return wrapped(*args, **kwargs)
155
+ else:
156
+ # Decorator was applied to a function or staticmethod.
157
+ return wrapped(*args, **kwargs)
158
+ else:
159
+ if inspect.isclass(instance):
160
+ # Decorator was applied to a classmethod.
161
+ return wrapped(*args, **kwargs)
162
+ else:
163
+ # Decorator was applied to an instancemethod.
164
+ return wrapped(*args, **kwargs)
165
+
166
+ Using these checks it is therefore possible to create a universal decorator
167
+ that can be applied in all situations. It is no longer necessary to create
168
+ different variants of decorators for normal functions and instance methods,
169
+ or use additional wrappers to convert a function decorator into one that
170
+ will work for instance methods.
171
+
172
+ In all cases, the wrapped function passed to the wrapper function is called
173
+ in the same way, with ``args`` and ``kwargs`` being passed. The
174
+ ``instance`` argument doesn't need to be used in calling the wrapped
175
+ function.
176
+
177
+ Links
178
+ -----
179
+
180
+ * **Documentation**: https://wrapt.readthedocs.io/
181
+ * **Source Code**: https://github.com/GrahamDumpleton/wrapt
182
+ * **Bug Reports**: https://github.com/GrahamDumpleton/wrapt/issues/
183
+ * **Changelog**: https://wrapt.readthedocs.io/en/latest/changes.html
184
+
185
+ .. |PyPI| image:: https://img.shields.io/pypi/v/wrapt.svg?logo=python&cacheSeconds=3600
186
+ :target: https://pypi.python.org/pypi/wrapt
187
+ .. |Documentation| image:: https://img.shields.io/badge/docs-wrapt.readthedocs.io-blue.svg
188
+ :target: https://wrapt.readthedocs.io/
@@ -0,0 +1,18 @@
1
+ wrapt/__init__.py,sha256=Q7ze6U0nRn3-Q5eOTy-q-creLNeyvO6PsmN3o-a556Y,1548
2
+ wrapt/__init__.pyi,sha256=d3CBY392zYAgBJoUeaRzdOUDbwlHgCxiLROnd4LdSG8,9402
3
+ wrapt/__wrapt__.py,sha256=UvhESjenqcPrl5dEIWA68lmdh_cCn5xphV_8KPSgbFo,1389
4
+ wrapt/_wrappers.c,sha256=ux1b_-Me_8QpJ_QRWvCq9jt_1CZ-9TFA-cVSLqi4_Zg,115800
5
+ wrapt/_wrappers.cpython-313t-x86_64-linux-musl.so,sha256=d7qUGFLBgxGyGITWcdt89mjoyJDuACCXE6pFbu7rrz0,308016
6
+ wrapt/arguments.py,sha256=q4bxH7GoCXhTCgxy-AEyvSnOq0ovMSHjN7ru3HWxlhA,2548
7
+ wrapt/decorators.py,sha256=ePWsg43Q5uHYSBGvbybwIZpsYdIhLGX9twbGZ7ygous,21091
8
+ wrapt/importer.py,sha256=E16XxhomZuX5jM_JEH4ZO-MYpNou1t5RZLJHWLCtsgM,12135
9
+ wrapt/patches.py,sha256=WJAKwOEeozpqgLAq_BlEu2HWbjMg9yaR65szi8J4GRQ,9907
10
+ wrapt/proxies.py,sha256=0-N74mBM3tsC_zEQ83to3Y5OMqdxEu4BhXs3Hq1GDCU,12517
11
+ wrapt/py.typed,sha256=la67KBlbjXN-_-DfGNcdOcjYumVpKG_Tkw-8n5dnGB4,8
12
+ wrapt/weakrefs.py,sha256=5HehYcKOKsRIghxLwnCZ4EJ67rhc0z1GH__pRILRLDc,4630
13
+ wrapt/wrappers.py,sha256=btpuNklFXdpnWlQVrgib1cY08M5tm1vTSd_XEjfEgxs,34439
14
+ wrapt-2.1.0.dev1.dist-info/METADATA,sha256=CNmr7bF_5MEtUa10LMFVj-2aCVXidPt8yOO5BVk5kLY,7370
15
+ wrapt-2.1.0.dev1.dist-info/WHEEL,sha256=h4pC9iBWw_8Z-J7SravVR0TmNuCvjicPx-vtyBZdXZI,113
16
+ wrapt-2.1.0.dev1.dist-info/top_level.txt,sha256=Jf7kcuXtwjUJMwOL0QzALDg2WiSiXiH9ThKMjN64DW0,6
17
+ wrapt-2.1.0.dev1.dist-info/RECORD,,
18
+ wrapt-2.1.0.dev1.dist-info/licenses/LICENSE,sha256=1PZoVKJN2i8qUoKRKu3r5rGBhrhihFEKQz14-tzYjl0,1304
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (80.9.0)
3
+ Root-Is-Purelib: false
4
+ Tag: cp313-cp313t-musllinux_1_2_x86_64
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 @@
1
+ wrapt