Skip to content

Commit 2df6ced

Browse files
committed
Use Ruff style, rather than PEP 8
1 parent 8fdadde commit 2df6ced

File tree

2 files changed

+23
-15
lines changed

2 files changed

+23
-15
lines changed

importlib_resources/functional.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -57,11 +57,7 @@ def contents(anchor, *path_names):
5757
DeprecationWarning,
5858
stacklevel=1,
5959
)
60-
return (
61-
resource.name
62-
for resource
63-
in _get_resource(anchor, path_names).iterdir()
64-
)
60+
return (resource.name for resource in _get_resource(anchor, path_names).iterdir())
6561

6662

6763
def _get_encoding_arg(path_names, encoding):

importlib_resources/tests/test_functional.py

Lines changed: 22 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,7 @@ class ModuleAnchorMixin:
2727

2828
class FunctionalAPIBase:
2929
def _gen_resourcetxt_path_parts(self):
30-
"""Yield various names of a text file in anchor02, each in a subTest
31-
"""
30+
"""Yield various names of a text file in anchor02, each in a subTest"""
3231
for path_parts in (
3332
('subdirectory', 'subsubdir', 'resource.txt'),
3433
('subdirectory/subsubdir/resource.txt',),
@@ -44,15 +43,20 @@ def test_read_text(self):
4443
)
4544
self.assertEqual(
4645
resources.read_text(
47-
self.anchor02, 'subdirectory', 'subsubdir', 'resource.txt',
46+
self.anchor02,
47+
'subdirectory',
48+
'subsubdir',
49+
'resource.txt',
4850
encoding='utf-8',
4951
),
5052
'a resource',
5153
)
5254
for path_parts in self._gen_resourcetxt_path_parts():
5355
self.assertEqual(
5456
resources.read_text(
55-
self.anchor02, *path_parts, encoding='utf-8',
57+
self.anchor02,
58+
*path_parts,
59+
encoding='utf-8',
5660
),
5761
'a resource',
5862
)
@@ -99,7 +103,8 @@ def test_open_text(self):
99103
self.assertEqual(f.read(), 'Hello, UTF-8 world!\n')
100104
for path_parts in self._gen_resourcetxt_path_parts():
101105
with resources.open_text(
102-
self.anchor02, *path_parts,
106+
self.anchor02,
107+
*path_parts,
103108
encoding='utf-8',
104109
) as f:
105110
self.assertEqual(f.read(), 'a resource')
@@ -135,7 +140,8 @@ def test_open_binary(self):
135140
self.assertEqual(f.read(), b'Hello, UTF-8 world!\n')
136141
for path_parts in self._gen_resourcetxt_path_parts():
137142
with resources.open_binary(
138-
self.anchor02, *path_parts,
143+
self.anchor02,
144+
*path_parts,
139145
) as f:
140146
self.assertEqual(f.read(), b'a resource')
141147

@@ -213,18 +219,24 @@ def test_text_errors(self):
213219
# Multiple path arguments need explicit encoding argument.
214220
with self.assertRaises(TypeError):
215221
func(
216-
self.anchor02, 'subdirectory',
217-
'subsubdir', 'resource.txt',
222+
self.anchor02,
223+
'subdirectory',
224+
'subsubdir',
225+
'resource.txt',
218226
)
219227

220228

221229
class FunctionalAPITest_StringAnchor(
222-
unittest.TestCase, FunctionalAPIBase, StringAnchorMixin,
230+
unittest.TestCase,
231+
FunctionalAPIBase,
232+
StringAnchorMixin,
223233
):
224234
pass
225235

226236

227237
class FunctionalAPITest_ModuleAnchor(
228-
unittest.TestCase, FunctionalAPIBase, ModuleAnchorMixin,
238+
unittest.TestCase,
239+
FunctionalAPIBase,
240+
ModuleAnchorMixin,
229241
):
230242
pass

0 commit comments

Comments
 (0)