wrapt
wrapt copied to clipboard
A Python module for decorators, wrappers and monkey patching.
Hi there, I'm having an issue when trying to call a WeakMethod of a decorated bound function. When trying to call the result of dereferencing the ref, it seems that...
I'm trying to use wrapt.ObjectProxy to wrap an aiohttp response. I try to use the proxy in an `async with` statement, but it errors out with `AttributeError: __aexit__` ``` ipython...
I'm using the new `super` (`future.builtins.newsuper.newsuper`) with Python 2.7.16 (and future 0.17.1) and I am getting an exception when not passing arguments to `super`. Using `future.builtins`'s `super` with no arguments...
The following code triggers a segfault when run with the latest version of wrapt from develop: ```python import wrapt pow(*map(wrapt.ObjectProxy, [1, 2, 3])) ``` I spotted this because I was...
Dear all, I really really love this package. There is one drawback which I want to share: ```python from wrapt import ObjectProxy class A(ObjectProxy): @property def error(self): raise ValueError("look here")...
This idea originated here: https://github.com/ionelmc/python-lazy-object-proxy/pull/18 Perhaps wrapt could do this as well. Opinions?
**Problem:** ``` >>> import wrapt, collections >>> class MyObject(object): pass >>> obj = MyObject() >>> isinstance(obj, collections.Iterable) False >>> wrp = wrapt.ObjectProxy(obj) >>> isinstance(wrp, collections.Iterable) True ``` **Cause:** This is...
Duck-typing relies pretty heavily on hasattr checks, so this difference in behavior could cause problems. e.g.: ``` python from wrapt import ObjectProxy assert hasattr(ObjectProxy(1), '__contains__') == hasattr(1, '__contains__') ``` For...
Python has some problems pickling wrappers in general, described [here](http://bugs.python.org/issue14577). Below is a test case: ``` >>> from wrapt import ObjectProxy >>> import pickle >>> pickle.dumps(ObjectProxy(1)) Traceback (most recent call...
A question recently came up on https://review.openstack.org/#/c/206253/ about using the universal wrapt decorator on @property methods, and this doesn't seem possible (see comments in that review); I'm wondering if u...