Skip to content

Commit

Permalink
Run ruff format
Browse files Browse the repository at this point in the history
  • Loading branch information
DimitriPapadopoulos committed Jan 14, 2025
1 parent 1dbba93 commit efd8921
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 21 deletions.
3 changes: 1 addition & 2 deletions src/packaging/_elffile.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,7 @@ def __init__(self, f: IO[bytes]) -> None:
}[(self.capacity, self.encoding)]
except KeyError as e:
raise ELFInvalid(
f"unrecognized capacity ({self.capacity}) or "
f"encoding ({self.encoding})"
f"unrecognized capacity ({self.capacity}) or encoding ({self.encoding})"
) from e

try:
Expand Down
3 changes: 1 addition & 2 deletions src/packaging/_manylinux.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,8 +161,7 @@ def _parse_glibc_version(version_str: str) -> tuple[int, int]:
m = re.match(r"(?P<major>[0-9]+)\.(?P<minor>[0-9]+)", version_str)
if not m:
warnings.warn(
f"Expected glibc version with 2 components major.minor,"
f" got: {version_str}",
f"Expected glibc version with 2 components major.minor, got: {version_str}",
RuntimeWarning,
stacklevel=2,
)
Expand Down
3 changes: 1 addition & 2 deletions src/packaging/_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -349,6 +349,5 @@ def _parse_marker_op(tokenizer: Tokenizer) -> Op:
return Op(tokenizer.read().text)
else:
return tokenizer.raise_syntax_error(
"Expected marker operator, one of "
"<=, <, !=, ==, >=, >, ~=, ===, in, not in"
"Expected marker operator, one of <=, <, !=, ==, >=, >, ~=, ===, in, not in"
)
6 changes: 3 additions & 3 deletions src/packaging/_tokenizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,9 +119,9 @@ def check(self, name: str, *, peek: bool = False) -> bool:
another check. If `peek` is set to `True`, the token is not loaded and
would need to be checked again.
"""
assert (
self.next_token is None
), f"Cannot check for {name!r}, already have {self.next_token!r}"
assert self.next_token is None, (
f"Cannot check for {name!r}, already have {self.next_token!r}"
)
assert name in self.rules, f"Unknown token name: {name!r}"

expression = self.rules[name]
Expand Down
3 changes: 1 addition & 2 deletions src/packaging/metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -678,8 +678,7 @@ def _process_license_files(self, value: list[str]) -> list[str]:
)
if pathlib.PureWindowsPath(path).as_posix() != path:
raise self._invalid_metadata(
f"{path!r} is invalid for {{field}}, "
"paths must use '/' delimiter"
f"{path!r} is invalid for {{field}}, paths must use '/' delimiter"
)
paths.append(path)
return paths
Expand Down
3 changes: 1 addition & 2 deletions src/packaging/specifiers.py
Original file line number Diff line number Diff line change
Expand Up @@ -816,8 +816,7 @@ def __and__(self, other: SpecifierSet | str) -> SpecifierSet:
specifier._prereleases = self._prereleases
else:
raise ValueError(
"Cannot combine SpecifierSets with True and False prerelease "
"overrides."
"Cannot combine SpecifierSets with True and False prerelease overrides."
)

return specifier
Expand Down
12 changes: 4 additions & 8 deletions tests/test_markers.py
Original file line number Diff line number Diff line change
Expand Up @@ -290,20 +290,17 @@ def test_environment_with_extra_none(self):
True,
),
(
"python_version ~= '2.7.0' and (os_name == 'foo' or "
"os_name == 'bar')",
"python_version ~= '2.7.0' and (os_name == 'foo' or os_name == 'bar')",
{"os_name": "foo", "python_version": "2.7.4"},
True,
),
(
"python_version ~= '2.7.0' and (os_name == 'foo' or "
"os_name == 'bar')",
"python_version ~= '2.7.0' and (os_name == 'foo' or os_name == 'bar')",
{"os_name": "bar", "python_version": "2.7.4"},
True,
),
(
"python_version ~= '2.7.0' and (os_name == 'foo' or "
"os_name == 'bar')",
"python_version ~= '2.7.0' and (os_name == 'foo' or os_name == 'bar')",
{"os_name": "other", "python_version": "2.7.4"},
False,
),
Expand Down Expand Up @@ -350,8 +347,7 @@ def test_parses_pep345_valid(self, marker_string):
False,
),
(
"python_version == '2.5' and platform.python_implementation"
"!= 'Jython'",
"python_version == '2.5' and platform.python_implementation!= 'Jython'",
{"python_version": "2.7"},
False,
),
Expand Down

0 comments on commit efd8921

Please sign in to comment.