Skip to content

Commit

Permalink
Some cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
micheles committed Dec 9, 2015
1 parent f22e94a commit 1ed48fd
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 4 deletions.
2 changes: 1 addition & 1 deletion CHANGES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ HISTORY

4.0.5 Fixed a bug signaled by David Goldstein: now you can use the name `f`
as a keyword argument of decorated functions. Avoid copying the globals,
as signaled by Benjamin Patterson (2015/12/09)
as signaled by Benjamin Peterson (2015/12/09)
4.0.4 Included a patch from Zev Benjamin: now decorated functions play well
with cProfile (2015/09/25)
4.0.3 Added a warning about the memoize example, as requested by Robert
Expand Down
3 changes: 0 additions & 3 deletions src/decorator.py
Original file line number Diff line number Diff line change
Expand Up @@ -242,19 +242,16 @@ def decorator(caller, _func=None):
# else return a decorator function
if inspect.isclass(caller):
name = caller.__name__.lower()
callerfunc = get_init(caller)
doc = 'decorator(%s) converts functions/generators into ' \
'factories of %s objects' % (caller.__name__, caller.__name__)
elif inspect.isfunction(caller):
if caller.__name__ == '<lambda>':
name = '_lambda_'
else:
name = caller.__name__
callerfunc = caller
doc = caller.__doc__
else: # assume caller is an object with a __call__ method
name = caller.__class__.__name__.lower()
callerfunc = caller.__call__.__func__
doc = caller.__call__.__doc__
evaldict = dict(_call_=caller, _decorate_=decorate)
return FunctionMaker.create(
Expand Down

0 comments on commit 1ed48fd

Please sign in to comment.