Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit d89e03e

Browse filesBrowse files
committed
Merge tag 'v5.0.6' into cpython
2 parents 89fd5e9 + f13c9b6 commit d89e03e
Copy full SHA for d89e03e

File tree

5 files changed

+9
-12
lines changed
Filter options

5 files changed

+9
-12
lines changed

‎Lib/importlib/_common.py

Copy file name to clipboardExpand all lines: Lib/importlib/_common.py
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ def normalize_path(path):
3131
str_path = str(path)
3232
parent, file_name = os.path.split(str_path)
3333
if parent:
34-
raise ValueError('{!r} must be only a file name'.format(path))
34+
raise ValueError(f'{path!r} must be only a file name')
3535
return file_name
3636

3737

@@ -65,7 +65,7 @@ def get_package(package):
6565
"""
6666
resolved = resolve(package)
6767
if wrap_spec(resolved).submodule_search_locations is None:
68-
raise TypeError('{!r} is not a package'.format(package))
68+
raise TypeError(f'{package!r} is not a package')
6969
return resolved
7070

7171

‎Lib/importlib/readers.py

Copy file name to clipboardExpand all lines: Lib/importlib/readers.py
+3-4Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -94,16 +94,15 @@ def joinpath(self, child):
9494
__truediv__ = joinpath
9595

9696
def open(self, *args, **kwargs):
97-
raise FileNotFoundError('{} is not a file'.format(self))
97+
raise FileNotFoundError(f'{self} is not a file')
9898

9999
@property
100100
def name(self):
101101
return self._paths[0].name
102102

103103
def __repr__(self):
104-
return 'MultiplexedPath({})'.format(
105-
', '.join("'{}'".format(path) for path in self._paths)
106-
)
104+
paths = ', '.join(f"'{path}'" for path in self._paths)
105+
return f'MultiplexedPath({paths})'
107106

108107

109108
class NamespaceReader(abc.TraversableResources):

‎Lib/importlib/resources.py

Copy file name to clipboardExpand all lines: Lib/importlib/resources.py
+1-3Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,7 @@ def open_binary(package: Package, resource: Resource) -> BinaryIO:
6868
if data is not None:
6969
return BytesIO(data)
7070

71-
raise FileNotFoundError(
72-
'{!r} resource not found in {!r}'.format(resource, spec.name)
73-
)
71+
raise FileNotFoundError(f'{resource!r} resource not found in {spec.name!r}')
7472

7573

7674
def open_text(

‎Lib/test/test_importlib/test_reader.py

Copy file name to clipboardExpand all lines: Lib/test/test_importlib/test_reader.py
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ def test_join_path(self):
7979
def test_repr(self):
8080
self.assertEqual(
8181
repr(MultiplexedPath(self.folder)),
82-
"MultiplexedPath('{}')".format(self.folder),
82+
f"MultiplexedPath('{self.folder}')",
8383
)
8484

8585
def test_name(self):
@@ -121,7 +121,7 @@ def test_files(self):
121121
reader = NamespaceReader(namespacedata01.__spec__.submodule_search_locations)
122122
root = os.path.abspath(os.path.join(__file__, '..', 'namespacedata01'))
123123
self.assertIsInstance(reader.files(), MultiplexedPath)
124-
self.assertEqual(repr(reader.files()), "MultiplexedPath('{}')".format(root))
124+
self.assertEqual(repr(reader.files()), f"MultiplexedPath('{root}')")
125125

126126

127127
if __name__ == '__main__':

‎Lib/test/test_importlib/test_resource.py

Copy file name to clipboardExpand all lines: Lib/test/test_importlib/test_resource.py
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ def setUp(self):
152152
data_path = pathlib.Path(self.ZIP_MODULE.__file__)
153153
data_dir = data_path.parent
154154
self.source_zip_path = data_dir / 'ziptestdata.zip'
155-
self.zip_path = pathlib.Path('{}.zip'.format(uuid.uuid4())).absolute()
155+
self.zip_path = pathlib.Path(f'{uuid.uuid4()}.zip').absolute()
156156
self.zip_path.write_bytes(self.source_zip_path.read_bytes())
157157
sys.path.append(str(self.zip_path))
158158
self.data = import_module('ziptestdata')

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.