[Config] Replace custom property decorator
This commit is contained in:
parent
a684029602
commit
099077fe20
|
@ -51,23 +51,6 @@ from deluge.common import JSON_FORMAT, get_default_config_dir
|
|||
log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
def prop(func):
|
||||
"""Function decorator for defining property attributes
|
||||
|
||||
The decorated function is expected to return a dictionary
|
||||
containing one or more of the following pairs:
|
||||
|
||||
fget - function for getting attribute value
|
||||
fset - function for setting attribute value
|
||||
fdel - function for deleting attribute
|
||||
|
||||
This can be conveniently constructed by the locals() builtin
|
||||
function; see:
|
||||
http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/205183
|
||||
"""
|
||||
return property(doc=func.__doc__, **func())
|
||||
|
||||
|
||||
def find_json_objects(text, decoder=json.JSONDecoder()):
|
||||
"""Find json objects in text.
|
||||
|
||||
|
@ -546,14 +529,11 @@ class Config:
|
|||
def config_file(self):
|
||||
return self.__config_file
|
||||
|
||||
@prop
|
||||
def config(): # pylint: disable=no-method-argument
|
||||
@property
|
||||
def config(self):
|
||||
"""The config dictionary"""
|
||||
return self.__config
|
||||
|
||||
def fget(self):
|
||||
return self.__config
|
||||
|
||||
def fdel(self):
|
||||
return self.save()
|
||||
|
||||
return locals()
|
||||
@config.deleter
|
||||
def config(self):
|
||||
return self.save()
|
||||
|
|
Loading…
Reference in New Issue