Skip to content


Browse files Browse the repository at this point in the history
Remove (probably unnecessary) copy_func usage
  • Loading branch information
nyalldawson committed Dec 5, 2016
1 parent d03d0a5 commit cc702c9
Showing 1 changed file with 2 additions and 12 deletions.
14 changes: 2 additions & 12 deletions python/core/
Expand Up @@ -187,24 +187,14 @@ def __exit__(self, ex_type, ex_value, traceback):
return False

def copy_func(f):
"""Based on (Glenn Maynard)"""
g = types.FunctionType(f.__code__, f.__globals__, name=f.__name__,
g = functools.update_wrapper(g, f)
g.__kwdefaults__ = f.__kwdefaults__
return g

class QgsTaskWrapper(QgsTask):

def __init__(self, description, flags, function, on_finished, *args, **kwargs):
QgsTask.__init__(self, description, flags)
self.args = args
self.kwargs = kwargs
self.function = copy_func(function)
self.on_finished = copy_func(on_finished) if on_finished else None
self.function = function
self.on_finished = on_finished
self.returned_values = None
self.exception = None

Expand Down

0 comments on commit cc702c9

Please sign in to comment.