Skip to content

Commit

Permalink
Actually _use_ the assign,update fields!
Browse files Browse the repository at this point in the history
  • Loading branch information
coldfix committed Feb 24, 2014
1 parent 3e2e752 commit f4e839c
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 8 deletions.
6 changes: 6 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
Changelog
~~~~~~~~~

0.0.6
^^^^^

- fix functools.update_wrapper emulation in black_magic.decorator.wraps().
(was supported but not used beforehand)

0.0.5
^^^^^

Expand Down
13 changes: 6 additions & 7 deletions black_magic/decorator.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,16 +58,15 @@ def from_function(cls, function, signature=None):
else:
funcname = None

def has(attr):
return hasattr(function, attr)

assign = list(filter(has, ('__module__', '__name__', '__qualname__',
'__doc__', '__annotations__')))
assign = dict((attr, getattr(function, attr))
for attr in ('__module__', '__name__', '__qualname__',
'__doc__', '__annotations__')
if hasattr(function, attr))
update = {'__dict__': function.__dict__}

return cls(signature or compat.signature(function),
funcname,
filename)
funcname=funcname, filename=filename,
assign=assign, update=update)

def decorate(self, callback):
"""
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
# invoke distutils
setup(
name='black-magic',
version='0.0.5',
version='0.0.6',
description='Decorator utility that operates on black magic',
long_description=long_description,
author='Thomas Gläßle',
Expand Down

0 comments on commit f4e839c

Please sign in to comment.