Skip to content

Commit 8510bd9

Browse files
Upgrade to ruff 0.9.1 (#865)
1 parent 9375ec2 commit 8510bd9

10 files changed

+15
-25
lines changed

.pre-commit-config.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ repos:
1616
additional_dependencies: [pyparsing, nox]
1717

1818
- repo: https://github.com/astral-sh/ruff-pre-commit
19-
rev: v0.1.11
19+
rev: v0.9.1
2020
hooks:
2121
- id: ruff
2222
args: [ --fix ]

pyproject.toml

+1-2
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ extend-select = [
7878
]
7979
ignore = [
8080
"B027",
81+
"F821",
8182
"N818",
8283
"RUF003",
8384
"RUF012",
@@ -95,6 +96,4 @@ ignore = [
9596
"Q003",
9697
"COM812",
9798
"COM819",
98-
"ISC001",
99-
"ISC002",
10099
]

src/packaging/_elffile.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,7 @@ def __init__(self, f: IO[bytes]) -> None:
6969
}[(self.capacity, self.encoding)]
7070
except KeyError as e:
7171
raise ELFInvalid(
72-
f"unrecognized capacity ({self.capacity}) or "
73-
f"encoding ({self.encoding})"
72+
f"unrecognized capacity ({self.capacity}) or encoding ({self.encoding})"
7473
) from e
7574

7675
try:

src/packaging/_manylinux.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -161,8 +161,7 @@ def _parse_glibc_version(version_str: str) -> tuple[int, int]:
161161
m = re.match(r"(?P<major>[0-9]+)\.(?P<minor>[0-9]+)", version_str)
162162
if not m:
163163
warnings.warn(
164-
f"Expected glibc version with 2 components major.minor,"
165-
f" got: {version_str}",
164+
f"Expected glibc version with 2 components major.minor, got: {version_str}",
166165
RuntimeWarning,
167166
stacklevel=2,
168167
)

src/packaging/_parser.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -349,6 +349,5 @@ def _parse_marker_op(tokenizer: Tokenizer) -> Op:
349349
return Op(tokenizer.read().text)
350350
else:
351351
return tokenizer.raise_syntax_error(
352-
"Expected marker operator, one of "
353-
"<=, <, !=, ==, >=, >, ~=, ===, in, not in"
352+
"Expected marker operator, one of <=, <, !=, ==, >=, >, ~=, ===, in, not in"
354353
)

src/packaging/_tokenizer.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -119,9 +119,9 @@ def check(self, name: str, *, peek: bool = False) -> bool:
119119
another check. If `peek` is set to `True`, the token is not loaded and
120120
would need to be checked again.
121121
"""
122-
assert (
123-
self.next_token is None
124-
), f"Cannot check for {name!r}, already have {self.next_token!r}"
122+
assert self.next_token is None, (
123+
f"Cannot check for {name!r}, already have {self.next_token!r}"
124+
)
125125
assert name in self.rules, f"Unknown token name: {name!r}"
126126

127127
expression = self.rules[name]

src/packaging/licenses/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@
3737
from packaging.licenses._spdx import EXCEPTIONS, LICENSES
3838

3939
__all__ = [
40-
"NormalizedLicenseExpression",
4140
"InvalidLicenseExpression",
41+
"NormalizedLicenseExpression",
4242
"canonicalize_license_expression",
4343
]
4444

src/packaging/metadata.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -678,8 +678,7 @@ def _process_license_files(self, value: list[str]) -> list[str]:
678678
)
679679
if pathlib.PureWindowsPath(path).as_posix() != path:
680680
raise self._invalid_metadata(
681-
f"{path!r} is invalid for {{field}}, "
682-
"paths must use '/' delimiter"
681+
f"{path!r} is invalid for {{field}}, paths must use '/' delimiter"
683682
)
684683
paths.append(path)
685684
return paths

src/packaging/specifiers.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -816,8 +816,7 @@ def __and__(self, other: SpecifierSet | str) -> SpecifierSet:
816816
specifier._prereleases = self._prereleases
817817
else:
818818
raise ValueError(
819-
"Cannot combine SpecifierSets with True and False prerelease "
820-
"overrides."
819+
"Cannot combine SpecifierSets with True and False prerelease overrides."
821820
)
822821

823822
return specifier

tests/test_markers.py

+4-8
Original file line numberDiff line numberDiff line change
@@ -290,20 +290,17 @@ def test_environment_with_extra_none(self):
290290
True,
291291
),
292292
(
293-
"python_version ~= '2.7.0' and (os_name == 'foo' or "
294-
"os_name == 'bar')",
293+
"python_version ~= '2.7.0' and (os_name == 'foo' or os_name == 'bar')",
295294
{"os_name": "foo", "python_version": "2.7.4"},
296295
True,
297296
),
298297
(
299-
"python_version ~= '2.7.0' and (os_name == 'foo' or "
300-
"os_name == 'bar')",
298+
"python_version ~= '2.7.0' and (os_name == 'foo' or os_name == 'bar')",
301299
{"os_name": "bar", "python_version": "2.7.4"},
302300
True,
303301
),
304302
(
305-
"python_version ~= '2.7.0' and (os_name == 'foo' or "
306-
"os_name == 'bar')",
303+
"python_version ~= '2.7.0' and (os_name == 'foo' or os_name == 'bar')",
307304
{"os_name": "other", "python_version": "2.7.4"},
308305
False,
309306
),
@@ -350,8 +347,7 @@ def test_parses_pep345_valid(self, marker_string):
350347
False,
351348
),
352349
(
353-
"python_version == '2.5' and platform.python_implementation"
354-
"!= 'Jython'",
350+
"python_version == '2.5' and platform.python_implementation!= 'Jython'",
355351
{"python_version": "2.7"},
356352
False,
357353
),

0 commit comments

Comments
 (0)