Commits

Anonymous committed 9fb09a2

Remove custom simple_decorator in facor for functools.wraps

  • Participants
  • Parent commits 35bd846

Comments (0)

Files changed (1)

File src/hornet/util.py

     """
     return [getattr(v, attr) for v in iterable]
 
-#TODO move to use python's new functools
-def simple_decorator(decorator_f):
-    """This decorator can be used to turn simple functions
-    into well-behaved decorators, so long as the decorators
-    are fairly simple. If a decorator expects a function and
-    returns a function (no descriptors), and if it doesn't
-    modify function attributes or docstring, then it is
-    eligible to use this. Simply apply `@simple_decorator` to
-    your decorator and it will automatically preserve the
-    docstring and function attributes of functions to which
-    it is applied.
-    
-    Modified, but based on http://wiki.python.org/moin/PythonDecoratorLibrary 
-    """
-    def new_decorator(f, *args, **kw):
-        g = decorator_f(f, *args, **kw)
-        g.__name__ = f.__name__
-        g.__doc__ = f.__doc__
-        g.__module__ = f.__module__
-        g.__dict__.update(f.__dict__)
-        return g
-    new_decorator.__name__ = decorator_f.__name__
-    new_decorator.__doc__ = decorator_f.__doc__
-    new_decorator.__module__ = decorator_f.__module__
-    new_decorator.__dict__.update(decorator_f.__dict__)
-    return new_decorator