From 62cdf090bf1eaf41e54b65a172bb221d143e6bfb Mon Sep 17 00:00:00 2001 From: Philipp Wolfer Date: Mon, 1 May 2023 16:05:56 +0200 Subject: [PATCH] Default implementation for Option.convert Avoids pylint warnings about hidden attribute and makes the code more readable. --- picard/config.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/picard/config.py b/picard/config.py index e068eec94..61fc92cb9 100644 --- a/picard/config.py +++ b/picard/config.py @@ -422,8 +422,6 @@ class Option(QtCore.QObject): self.section = section self.name = name self.default = default - if not hasattr(self, "convert"): - self.convert = type(default) self.registry[key] = self @classmethod @@ -439,6 +437,9 @@ class Option(QtCore.QObject): def exists(cls, section, name): return (section, name) in cls.registry + def convert(self, value): + return type(self.default)(value) + class TextOption(Option):