summaryrefslogtreecommitdiff
path: root/pylint/utils/utils.py
diff options
context:
space:
mode:
authorPierre Sassoulas <pierre.sassoulas@gmail.com>2021-02-21 13:27:11 +0100
committerPierre Sassoulas <pierre.sassoulas@gmail.com>2021-02-21 15:36:16 +0100
commit5bed07eba999130b6551acc7c43192d6a8eada43 (patch)
tree09e3a11503bd074363556e8a5fd33fc0e8db7fc4 /pylint/utils/utils.py
parenta1e553d3bb07c56ca99c31279f9af104bede0a32 (diff)
downloadpylint-git-5bed07eba999130b6551acc7c43192d6a8eada43.tar.gz
Move from % string formatting syntax to f-string or .format()
Diffstat (limited to 'pylint/utils/utils.py')
-rw-r--r--pylint/utils/utils.py10
1 files changed, 4 insertions, 6 deletions
diff --git a/pylint/utils/utils.py b/pylint/utils/utils.py
index b81807bc4..0f4e0f518 100644
--- a/pylint/utils/utils.py
+++ b/pylint/utils/utils.py
@@ -52,7 +52,7 @@ def get_module_and_frameid(node):
def get_rst_title(title, character):
"""Permit to get a title formatted as ReStructuredText test (underlined with a chosen character)."""
- return "%s\n%s\n" % (title, character * len(title))
+ return "{}\n{}\n".format(title, character * len(title))
def get_rst_section(section, options, doc=None):
@@ -258,9 +258,7 @@ def register_plugins(linter, directory):
# empty module name (usually emacs auto-save files)
continue
except ImportError as exc:
- print(
- "Problem importing module %s: %s" % (filename, exc), file=sys.stderr
- )
+ print(f"Problem importing module {filename}: {exc}", file=sys.stderr)
else:
if hasattr(module, "register"):
module.register(linter)
@@ -367,7 +365,7 @@ def _format_option_value(optdict, value):
if isinstance(value, (list, tuple)):
value = ",".join(_format_option_value(optdict, item) for item in value)
elif isinstance(value, dict):
- value = ",".join("%s:%s" % (k, v) for k, v in value.items())
+ value = ",".join(f"{k}:{v}" for k, v in value.items())
elif hasattr(value, "match"): # optdict.get('type') == 'regexp'
# compiled regexp
value = value.pattern
@@ -406,7 +404,7 @@ def _ini_format(stream, options):
value = separator.join(x + "," for x in str(value).split(","))
# remove trailing ',' from last element of the list
value = value[:-1]
- print("%s=%s" % (optname, value), file=stream)
+ print(f"{optname}={value}", file=stream)
class IsortDriver: