Skip to content

Commit cc702c9

Browse files
committed
Remove (probably unnecessary) copy_func usage
1 parent d03d0a5 commit cc702c9

File tree

1 file changed

+2
-12
lines changed

1 file changed

+2
-12
lines changed

python/core/__init__.py

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -187,24 +187,14 @@ def __exit__(self, ex_type, ex_value, traceback):
187187
return False
188188

189189

190-
def copy_func(f):
191-
"""Based on http://stackoverflow.com/a/6528148/190597 (Glenn Maynard)"""
192-
g = types.FunctionType(f.__code__, f.__globals__, name=f.__name__,
193-
argdefs=f.__defaults__,
194-
closure=f.__closure__)
195-
g = functools.update_wrapper(g, f)
196-
g.__kwdefaults__ = f.__kwdefaults__
197-
return g
198-
199-
200190
class QgsTaskWrapper(QgsTask):
201191

202192
def __init__(self, description, flags, function, on_finished, *args, **kwargs):
203193
QgsTask.__init__(self, description, flags)
204194
self.args = args
205195
self.kwargs = kwargs
206-
self.function = copy_func(function)
207-
self.on_finished = copy_func(on_finished) if on_finished else None
196+
self.function = function
197+
self.on_finished = on_finished
208198
self.returned_values = None
209199
self.exception = None
210200

0 commit comments

Comments
 (0)