Skip to content

Commit 558f5bf

Browse files
committed
Formatting nitpicks
1 parent 1e98e35 commit 558f5bf

File tree

2 files changed

+15
-9
lines changed

2 files changed

+15
-9
lines changed

importlib_resources/functional.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
"""Simplified function-based API for importlib.resources
2-
"""
1+
"""Simplified function-based API for importlib.resources"""
32

43
import warnings
54

@@ -8,6 +7,7 @@
87

98
_MISSING = object()
109

10+
1111
def open_binary(anchor, *path_names):
1212
"""Open for binary reading the *resource* within *package*."""
1313
return _get_resource(anchor, path_names).open('rb')

importlib_resources/tests/test_functional.py

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ class ModuleAnchorMixin:
2020
from . import data02 as anchor02
2121

2222

23-
class FunctionalAPIBase():
23+
class FunctionalAPIBase:
2424
def _gen_resourcetxt_path_parts(self):
2525
"""Yield various names of a text file in anchor02, each in a subTest
2626
"""
@@ -61,18 +61,21 @@ def test_read_text(self):
6161
resources.read_text(self.anchor01, 'utf-16.file')
6262
self.assertEqual(
6363
resources.read_text(
64-
self.anchor01, 'binary.file', encoding='latin1',
64+
self.anchor01,
65+
'binary.file',
66+
encoding='latin1',
6567
),
6668
'\x00\x01\x02\x03',
6769
)
6870
self.assertEqual(
6971
resources.read_text(
70-
self.anchor01, 'utf-16.file',
72+
self.anchor01,
73+
'utf-16.file',
7174
errors='backslashreplace',
7275
),
7376
'Hello, UTF-16 world!\n'.encode('utf-16').decode(
7477
errors='backslashreplace',
75-
)
78+
),
7679
)
7780

7881
def test_read_binary(self):
@@ -105,18 +108,21 @@ def test_open_text(self):
105108
with self.assertRaises(UnicodeDecodeError):
106109
f.read()
107110
with resources.open_text(
108-
self.anchor01, 'binary.file', encoding='latin1',
111+
self.anchor01,
112+
'binary.file',
113+
encoding='latin1',
109114
) as f:
110115
self.assertEqual(f.read(), '\x00\x01\x02\x03')
111116
with resources.open_text(
112-
self.anchor01, 'utf-16.file',
117+
self.anchor01,
118+
'utf-16.file',
113119
errors='backslashreplace',
114120
) as f:
115121
self.assertEqual(
116122
f.read(),
117123
'Hello, UTF-16 world!\n'.encode('utf-16').decode(
118124
errors='backslashreplace',
119-
)
125+
),
120126
)
121127

122128
def test_open_binary(self):

0 commit comments

Comments
 (0)