From 2c457b8dcd7c77f78557dfd02a4111862c0eb31c Mon Sep 17 00:00:00 2001 From: Laurent Monin Date: Sun, 24 Mar 2019 17:44:18 +0100 Subject: [PATCH] Fix PyLint E0202 picard/config.py:260:4: E0202: An attribute defined in picard.config line 244 hides this method (method-hidden) picard/config.py:287:4: E0202: An attribute defined in picard.config line 244 hides this method (method-hidden) --- picard/config.py | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/picard/config.py b/picard/config.py index 86f14dfc6..531b121ff 100644 --- a/picard/config.py +++ b/picard/config.py @@ -249,6 +249,18 @@ class Option(QtCore.QObject): return cls.registry.get((section, name)) +def _convert_to_bool(value): + # The QSettings IniFormat saves boolean values as the strings "true" + # and "false". Thus, explicit boolean and string comparisons are used + # to determine the value. NOTE: In PyQt >= 4.8.3, QSettings.value has + # an optional "type" parameter that avoids this. But we still support + # PyQt >= 4.5, so that is not used. + return value is True or value == "true" + +def _convert_to_int_list(values): + return list(map(int, values)) + + class TextOption(Option): convert = str @@ -256,14 +268,7 @@ class TextOption(Option): class BoolOption(Option): - @staticmethod - def convert(value): - # The QSettings IniFormat saves boolean values as the strings "true" - # and "false". Thus, explicit boolean and string comparisons are used - # to determine the value. NOTE: In PyQt >= 4.8.3, QSettings.value has - # an optional "type" parameter that avoids this. But we still support - # PyQt >= 4.5, so that is not used. - return value is True or value == "true" + convert = _convert_to_bool class IntOption(Option): @@ -283,9 +288,7 @@ class ListOption(Option): class IntListOption(Option): - @staticmethod - def convert(values): - return list(map(int, values)) + convert = _convert_to_int_list config = None