summaryrefslogtreecommitdiffstats
path: root/Lib/importlib/metadata
diff options
context:
space:
mode:
authorJason R. Coombs <jaraco@jaraco.com>2021-05-26 18:49:06 (GMT)
committerGitHub <noreply@github.com>2021-05-26 18:49:06 (GMT)
commite6c815d2e34be5fdf6dbe773f0781691746d2289 (patch)
tree21c1669843ceec4d2760e8f54ec25c48ce32120f /Lib/importlib/metadata
parent06ac3a4742228b0230981720060248a7425b2486 (diff)
downloadcpython-e6c815d2e34be5fdf6dbe773f0781691746d2289.zip
cpython-e6c815d2e34be5fdf6dbe773f0781691746d2289.tar.gz
cpython-e6c815d2e34be5fdf6dbe773f0781691746d2289.tar.bz2
bpo-38693: importlib.metadata f-strings (GH-26383)
Automerge-Triggered-By: GH:jaraco
Diffstat (limited to 'Lib/importlib/metadata')
-rw-r--r--Lib/importlib/metadata/__init__.py9
1 files changed, 4 insertions, 5 deletions
diff --git a/Lib/importlib/metadata/__init__.py b/Lib/importlib/metadata/__init__.py
index 9637a82..94b8386 100644
--- a/Lib/importlib/metadata/__init__.py
+++ b/Lib/importlib/metadata/__init__.py
@@ -48,8 +48,7 @@ class PackageNotFoundError(ModuleNotFoundError):
"""The package was not found."""
def __str__(self):
- tmpl = "No package metadata was found for {self.name}"
- return tmpl.format(**locals())
+ return f"No package metadata was found for {self.name}"
@property
def name(self):
@@ -386,7 +385,7 @@ class FileHash:
self.mode, _, self.value = spec.partition('=')
def __repr__(self):
- return '<FileHash mode: {} value: {}>'.format(self.mode, self.value)
+ return f'<FileHash mode: {self.mode} value: {self.value}>'
class Distribution:
@@ -570,13 +569,13 @@ class Distribution:
"""
def make_condition(name):
- return name and 'extra == "{name}"'.format(name=name)
+ return name and f'extra == "{name}"'
def parse_condition(section):
section = section or ''
extra, sep, markers = section.partition(':')
if extra and markers:
- markers = '({markers})'.format(markers=markers)
+ markers = f'({markers})'
conditions = list(filter(None, [markers, make_condition(extra)]))
return '; ' + ' and '.join(conditions) if conditions else ''