AttributeError: 'mappingproxy' object has no attribute 'update'
This is because functools.update_wrapper try to mutate the __dict__, which is not possible for class.
It would be relatively easy to fix by using setattr(cls,...) rather than mutating cls.__dict__:
def update_wrapper(wrapper, wrapped):
"""Same as `functools.update_wrapper`, but supports class."""
for name in functools.WRAPPER_ASSIGNMENTS:
try:
value = getattr(wrapped, name)
except AttributeError:
pass
else:
setattr(wrapper, name, value)
return wrapper
I am not sure that it makes sense to apply functools.wraps() for classes. It was not designed for this. inspect.unwrap() failed for classes with __wrapped__ descriptor (like classmethod), so now I made it not unwrapping classes at all.