Remove deprecated calls to apply()
apply() has been deprecated since Python 2.3, and won't be working in python 3 anymore. Use the functional equivalent throughout. Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
This commit is contained in:
parent
e145beb394
commit
ae8a1cb79f
@ -24,26 +24,25 @@ class CustomConfigParser(SafeConfigParser):
|
|||||||
"""Same as config.get, but returns the "default" option if there
|
"""Same as config.get, but returns the "default" option if there
|
||||||
is no such option specified."""
|
is no such option specified."""
|
||||||
if self.has_option(section, option):
|
if self.has_option(section, option):
|
||||||
return apply(self.get, [section, option] + list(args), kwargs)
|
return self.get(*(section, option) + args, **kwargs)
|
||||||
else:
|
else:
|
||||||
return default
|
return default
|
||||||
|
|
||||||
def getdefaultint(self, section, option, default, *args, **kwargs):
|
def getdefaultint(self, section, option, default, *args, **kwargs):
|
||||||
if self.has_option(section, option):
|
if self.has_option(section, option):
|
||||||
return apply(self.getint, [section, option] + list(args), kwargs)
|
return self.getint (*(section, option) + args, **kwargs)
|
||||||
else:
|
else:
|
||||||
return default
|
return default
|
||||||
|
|
||||||
def getdefaultfloat(self, section, option, default, *args, **kwargs):
|
def getdefaultfloat(self, section, option, default, *args, **kwargs):
|
||||||
if self.has_option(section, option):
|
if self.has_option(section, option):
|
||||||
return apply(self.getfloat, [section, option] + list(args), kwargs)
|
return self.getfloat(*(section, option) + args, **kwargs)
|
||||||
else:
|
else:
|
||||||
return default
|
return default
|
||||||
|
|
||||||
def getdefaultboolean(self, section, option, default, *args, **kwargs):
|
def getdefaultboolean(self, section, option, default, *args, **kwargs):
|
||||||
if self.has_option(section, option):
|
if self.has_option(section, option):
|
||||||
return apply(self.getboolean, [section, option] + list(args),
|
return self.getboolean(*(section, option) + args, **kwargs)
|
||||||
kwargs)
|
|
||||||
else:
|
else:
|
||||||
return default
|
return default
|
||||||
|
|
||||||
@ -91,9 +90,9 @@ class ConfigHelperMixin:
|
|||||||
def _confighelper_runner(self, option, default, defaultfunc, mainfunc):
|
def _confighelper_runner(self, option, default, defaultfunc, mainfunc):
|
||||||
"""Return config value for getsection()"""
|
"""Return config value for getsection()"""
|
||||||
if default == CustomConfigDefault:
|
if default == CustomConfigDefault:
|
||||||
return apply(mainfunc, [self.getsection(), option])
|
return mainfunc(*[self.getsection(), option])
|
||||||
else:
|
else:
|
||||||
return apply(defaultfunc, [self.getsection(), option, default])
|
return defaultfunc(*[self.getsection(), option, default])
|
||||||
|
|
||||||
|
|
||||||
def getconf(self, option,
|
def getconf(self, option,
|
||||||
|
@ -214,8 +214,7 @@ def initInstanceLimit(instancename, instancemax):
|
|||||||
class InstanceLimitedThread(ExitNotifyThread):
|
class InstanceLimitedThread(ExitNotifyThread):
|
||||||
def __init__(self, instancename, *args, **kwargs):
|
def __init__(self, instancename, *args, **kwargs):
|
||||||
self.instancename = instancename
|
self.instancename = instancename
|
||||||
|
super(InstanceLimitedThread, self).__init__(*args, **kwargs)
|
||||||
apply(ExitNotifyThread.__init__, (self,) + args, kwargs)
|
|
||||||
|
|
||||||
def start(self):
|
def start(self):
|
||||||
instancelimitedsems[self.instancename].acquire()
|
instancelimitedsems[self.instancename].acquire()
|
||||||
|
@ -66,7 +66,7 @@ class CursesUtil:
|
|||||||
"""Perform an operation with full locking."""
|
"""Perform an operation with full locking."""
|
||||||
self.lock()
|
self.lock()
|
||||||
try:
|
try:
|
||||||
apply(target, args, kwargs)
|
target(*args, **kwargs)
|
||||||
finally:
|
finally:
|
||||||
self.unlock()
|
self.unlock()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user