Skip to content

Commit feca432

Browse files
committed
Apply changes suggested by ruff.
1 parent 7f9ce8a commit feca432

6 files changed

Lines changed: 23 additions & 25 deletions

File tree

pth-tester/pth_tester.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
has_socket = False
33

44

5-
# The pth_tester module should be initalized by processing the `.pth` file
5+
# The pth_tester module should be initialized by processing the `.pth` file
66
# created on installation.
77
def init():
88
global initialized

pth-tester/setup.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,7 @@
77
# Copied from setuptools:
88
# (https://github.com/pypa/setuptools/blob/7c859e017368360ba66c8cc591279d8964c031bc/setup.py#L40C6-L82)
99
class install_with_pth(install):
10-
"""
11-
Custom install command to install a .pth file.
10+
"""Custom install command to install a .pth file.
1211
1312
This hack is necessary because there's no standard way to install behavior
1413
on startup (and it's debatable if there should be one). This hack (ab)uses
@@ -30,9 +29,7 @@ def finalize_options(self):
3029
self._restore_install_lib()
3130

3231
def _restore_install_lib(self):
33-
"""
34-
Undo secondary effect of `extra_path` adding to `install_lib`
35-
"""
32+
"""Undo secondary effect of `extra_path` adding to `install_lib`"""
3633
suffix = os.path.relpath(self.install_lib, self.install_libbase)
3734

3835
if suffix.strip() == self._pth_contents.strip():

tests/test_common.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,9 @@ def test_bootstrap_modules():
5151
except ModuleNotFoundError:
5252
missing.append(module)
5353

54-
assert (
55-
len(missing) == 0
56-
), f"Missing bootstrap modules: {', '.join(str(m) for m in missing)}"
54+
assert len(missing) == 0, (
55+
f"Missing bootstrap modules: {', '.join(str(m) for m in missing)}"
56+
)
5757

5858

5959
def test_stdlib_modules():
@@ -139,9 +139,9 @@ def test_stdlib_modules():
139139
except ModuleNotFoundError:
140140
missing.append(module)
141141

142-
assert (
143-
len(missing) == 0
144-
), f"Missing stdlib modules: {', '.join(str(m) for m in missing)}"
142+
assert len(missing) == 0, (
143+
f"Missing stdlib modules: {', '.join(str(m) for m in missing)}"
144+
)
145145

146146

147147
def test_sysconfig_data():
@@ -284,9 +284,9 @@ def test_hashlib():
284284
digest_args = []
285285
msg = getattr(hashlib, algorithm)()
286286
msg.update(b"Hello world")
287-
assert (
288-
msg.hexdigest(*digest_args) == expected
289-
), f"{algorithm} digest was {msg.hexdigest(*digest_args)}"
287+
assert msg.hexdigest(*digest_args) == expected, (
288+
f"{algorithm} digest was {msg.hexdigest(*digest_args)}"
289+
)
290290

291291

292292
def test_sqlite3():

tests/test_macOS.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,6 @@ def test_stdlib_modules():
8181
except ModuleNotFoundError:
8282
missing.append(module)
8383

84-
assert (
85-
len(missing) == 0
86-
), f"Missing stdlib modules: {', '.join(str(m) for m in missing)}"
84+
assert len(missing) == 0, (
85+
f"Missing stdlib modules: {', '.join(str(m) for m in missing)}"
86+
)

tests/test_thirdparty.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@
1111

1212
def xfail_if_not_installed(package_name):
1313
"""A test decorator that xfails a test if the named package isn't installed.
14-
The third-party tests are dependant on packages being built. During pre-release some
14+
15+
The third-party tests are dependent on packages being built. During pre-release some
1516
packages won't be compilable. So - the pyproject.toml installs third party packages
1617
with some conditional gating.
1718
@@ -191,10 +192,10 @@ def test_pandas():
191192

192193
# Pandas 1.5 changed the API for to_csv()
193194
if tuple(int(v) for v in __version__.split(".")[:2]) < (1, 5):
194-
kwargs = dict(line_terminator="\n")
195+
kwargs = {"line_terminator": "\n"}
195196
else:
196-
kwargs = dict(lineterminator="\n")
197+
kwargs = {"lineterminator": "\n"}
197198

198-
assert (
199-
",Letter,Number\n" "0,alpha,1\n" "1,bravo,2\n" "2,charlie,3\n"
200-
) == df.to_csv(**kwargs)
199+
assert (",Letter,Number\n0,alpha,1\n1,bravo,2\n2,charlie,3\n") == df.to_csv(
200+
**kwargs
201+
)

tests/testbed.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ def run_tests():
3232
# macOS, output the log sentinel multiple times to decrease the chance of
3333
# this happening.
3434
if sys.platform in {"darwin", "ios"}:
35-
for i in range(0, 6):
35+
for _ in range(0, 6):
3636
time.sleep(0.5)
3737
print(f">>>>>>>>>> EXIT {returncode} <<<<<<<<<<")
3838
else:

0 commit comments

Comments
 (0)