diff options
Diffstat (limited to 'pylint/checkers')
-rw-r--r-- | pylint/checkers/base.py | 15 | ||||
-rw-r--r-- | pylint/checkers/classes.py | 2 | ||||
-rw-r--r-- | pylint/checkers/variables.py | 6 |
3 files changed, 5 insertions, 18 deletions
diff --git a/pylint/checkers/base.py b/pylint/checkers/base.py index 647c201d9..0a836de4c 100644 --- a/pylint/checkers/base.py +++ b/pylint/checkers/base.py @@ -1331,7 +1331,6 @@ class BasicChecker(_BasicChecker): isinstance(value, astroid.Instance) and value.qname() in DEFAULT_ARGUMENT_SYMBOLS ): - if value is default: msg = DEFAULT_ARGUMENT_SYMBOLS[value.qname()] elif isinstance(value, astroid.Instance) or is_iterable(value): @@ -1350,10 +1349,7 @@ class BasicChecker(_BasicChecker): msg = f"{default.as_string()} ({value.qname()})" else: # this argument is a name - msg = "{} ({})".format( - default.as_string(), - DEFAULT_ARGUMENT_SYMBOLS[value.qname()], - ) + msg = f"{default.as_string()} ({DEFAULT_ARGUMENT_SYMBOLS[value.qname()]})" self.add_message("dangerous-default-value", node=node, args=(msg,)) @utils.check_messages("unreachable", "lost-exception") @@ -2437,14 +2433,9 @@ class ComparisonChecker(_BasicChecker): if checking_for_absence: absence_text = "not " if nan_left: - suggestion = "'{}math.isnan({})'".format( - absence_text, right_value.as_string() - ) + suggestion = f"'{absence_text}math.isnan({right_value.as_string()})'" else: - suggestion = "'{}math.isnan({})'".format( - absence_text, left_value.as_string() - ) - + suggestion = f"'{absence_text}math.isnan({left_value.as_string()})'" self.add_message( "nan-comparison", node=root_node, diff --git a/pylint/checkers/classes.py b/pylint/checkers/classes.py index aada6bbf3..83abf758f 100644 --- a/pylint/checkers/classes.py +++ b/pylint/checkers/classes.py @@ -1604,7 +1604,7 @@ a metaclass class method.", valid = repr(config[0]) else: valid = ", ".join(repr(v) for v in config[:-1]) - valid = "{} or {!r}".format(valid, config[-1]) + valid = f"{valid} or {config[-1]!r}" self.add_message(message, args=(method_name, valid), node=node) def _check_bases_classes(self, node): diff --git a/pylint/checkers/variables.py b/pylint/checkers/variables.py index 01cf8ecbd..1e96f1b4e 100644 --- a/pylint/checkers/variables.py +++ b/pylint/checkers/variables.py @@ -1643,11 +1643,7 @@ class VariablesChecker(BaseChecker): return if isinstance(stmt, astroid.ImportFrom): if asname is not None: - msg = "{} imported from {} as {}".format( - qname, - stmt.modname, - asname, - ) + msg = f"{qname} imported from {stmt.modname} as {asname}" else: msg = f"{name} imported from {stmt.modname}" self.add_message("unused-import", args=msg, node=stmt) |