mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-17 00:04:02 -04:00
Remove (probably unnecessary) copy_func usage
This commit is contained in:
parent
d03d0a5b47
commit
cc702c9c81
@ -187,24 +187,14 @@ class edit(object):
|
|||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
def copy_func(f):
|
|
||||||
"""Based on http://stackoverflow.com/a/6528148/190597 (Glenn Maynard)"""
|
|
||||||
g = types.FunctionType(f.__code__, f.__globals__, name=f.__name__,
|
|
||||||
argdefs=f.__defaults__,
|
|
||||||
closure=f.__closure__)
|
|
||||||
g = functools.update_wrapper(g, f)
|
|
||||||
g.__kwdefaults__ = f.__kwdefaults__
|
|
||||||
return g
|
|
||||||
|
|
||||||
|
|
||||||
class QgsTaskWrapper(QgsTask):
|
class QgsTaskWrapper(QgsTask):
|
||||||
|
|
||||||
def __init__(self, description, flags, function, on_finished, *args, **kwargs):
|
def __init__(self, description, flags, function, on_finished, *args, **kwargs):
|
||||||
QgsTask.__init__(self, description, flags)
|
QgsTask.__init__(self, description, flags)
|
||||||
self.args = args
|
self.args = args
|
||||||
self.kwargs = kwargs
|
self.kwargs = kwargs
|
||||||
self.function = copy_func(function)
|
self.function = function
|
||||||
self.on_finished = copy_func(on_finished) if on_finished else None
|
self.on_finished = on_finished
|
||||||
self.returned_values = None
|
self.returned_values = None
|
||||||
self.exception = None
|
self.exception = None
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user