diff --git a/doc/exts/pylint_extensions.py b/doc/exts/pylint_extensions.py index 02e9be5bc23..4dc6f184f62 100755 --- a/doc/exts/pylint_extensions.py +++ b/doc/exts/pylint_extensions.py @@ -37,7 +37,7 @@ def builder_inited(app): if name[0] == "_" or name in DEPRECATED_MODULES: continue if ext == ".py": - modules.append("pylint.extensions.%s" % name) + modules.append(f"pylint.extensions.{name}") elif ext == ".rst": doc_files["pylint.extensions." + name] = os.path.join(ext_path, filename) modules.sort() diff --git a/pylint/checkers/__init__.py b/pylint/checkers/__init__.py index 4bc586a1c4c..ffc9402232f 100644 --- a/pylint/checkers/__init__.py +++ b/pylint/checkers/__init__.py @@ -65,8 +65,8 @@ def table_lines_from_stats(stats, old_stats, columns): diff_str = diff_string(old, new) else: old, diff_str = "NC", "NC" - new = "%.3f" % new if isinstance(new, float) else str(new) - old = "%.3f" % old if isinstance(old, float) else str(old) + new = f"{new:.3f}" if isinstance(new, float) else str(new) + old = f"{old:.3f}" if isinstance(old, float) else str(old) lines += (m_type.replace("_", " "), new, old, diff_str) return lines diff --git a/pylint/checkers/base.py b/pylint/checkers/base.py index 352e20ebe46..ae4ca15d289 100644 --- a/pylint/checkers/base.py +++ b/pylint/checkers/base.py @@ -193,7 +193,7 @@ class AnyStyle(NamingStyle): ["set()", "{}", "[]"], ), **{ - x: "%s()" % x + x: f"{x}()" for x in ( "collections.deque", "collections.ChainMap", @@ -407,12 +407,12 @@ def report_by_type_stats(sect, stats, old_stats): try: documented = total - stats["undocumented_" + node_type] percent = (documented * 100.0) / total - nice_stats[node_type]["percent_documented"] = "%.2f" % percent + nice_stats[node_type]["percent_documented"] = f"{percent:.2f}" except KeyError: nice_stats[node_type]["percent_documented"] = "NC" try: percent = (stats["badname_" + node_type] * 100.0) / total - nice_stats[node_type]["percent_badname"] = "%.2f" % percent + nice_stats[node_type]["percent_badname"] = f"{percent:.2f}" except KeyError: nice_stats[node_type]["percent_badname"] = "NC" lines = ("type", "number", "old number", "difference", "%documented", "%badname") @@ -1706,8 +1706,7 @@ def _create_naming_options(): "type": "choice", "choices": list(NAMING_STYLES.keys()), "metavar": "