diff options
author | Calum Lind <calumlind+deluge@gmail.com> | 2022-02-05 10:31:31 +0000 |
---|---|---|
committer | Calum Lind <calumlind+deluge@gmail.com> | 2022-02-05 16:13:10 +0000 |
commit | 099077fe20bf329b8e846fda001262f3e8071fd9 (patch) | |
tree | 060f9ba2227d39b79263d1ca1dc6739254fb0835 /deluge | |
parent | a68402960230f7df938434646ef3998bc2b6bfd0 (diff) | |
download | deluge-099077fe20bf329b8e846fda001262f3e8071fd9.tar.gz deluge-099077fe20bf329b8e846fda001262f3e8071fd9.tar.bz2 deluge-099077fe20bf329b8e846fda001262f3e8071fd9.zip |
[Config] Replace custom property decorator
Diffstat (limited to 'deluge')
-rw-r--r-- | deluge/config.py | 32 |
1 files changed, 6 insertions, 26 deletions
diff --git a/deluge/config.py b/deluge/config.py index e8577dc35..9c11bfde0 100644 --- a/deluge/config.py +++ b/deluge/config.py @@ -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() |