Skip to content

Commit

Permalink
Apply ruff rules (RUF) (#800)
Browse files Browse the repository at this point in the history
* Apply ruff rull RUF022

RUF022 `__all__` is not sorted

* Apply ruff rule RUF023

RUF023 `Tag.__slots__` is not sorted

* Apply ruff rule RUF027

RUF027 Possible f-string without an `f` prefix

* Enable ruff rules (RUF)
  • Loading branch information
DimitriPapadopoulos committed Jul 13, 2024
1 parent 793ee28 commit 4493dfc
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 6 deletions.
5 changes: 4 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ extend-select = [
"I",
"N",
"UP",
"RUF",
"W"
]
ignore = [
Expand All @@ -80,8 +81,10 @@ ignore = [
"B028",
"B904",
"N818",
"UP032",
"RUF003",
"RUF012",
"UP030",
"UP032",
# https://docs.astral.sh/ruff/formatter/#conflicting-lint-rules
"W191",
"E111",
Expand Down
2 changes: 1 addition & 1 deletion src/packaging/markers.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@

__all__ = [
"InvalidMarker",
"Marker",
"UndefinedComparison",
"UndefinedEnvironmentName",
"Marker",
"default_environment",
]

Expand Down
4 changes: 2 additions & 2 deletions src/packaging/metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -688,8 +688,8 @@ def from_raw(cls, data: RawMetadata, *, validate: bool = True) -> Metadata:
field = _RAW_TO_EMAIL_MAPPING[key]
exc = InvalidMetadata(
field,
"{field} introduced in metadata version "
"{field_metadata_version}, not {metadata_version}",
f"{field} introduced in metadata version "
f"{field_metadata_version}, not {metadata_version}",
)
exceptions.append(exc)
continue
Expand Down
2 changes: 1 addition & 1 deletion src/packaging/tags.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class Tag:
is also supported.
"""

__slots__ = ["_interpreter", "_abi", "_platform", "_hash"]
__slots__ = ["_abi", "_hash", "_interpreter", "_platform"]

def __init__(self, interpreter: str, abi: str, platform: str) -> None:
self._interpreter = interpreter.lower()
Expand Down
2 changes: 1 addition & 1 deletion src/packaging/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

from ._structures import Infinity, InfinityType, NegativeInfinity, NegativeInfinityType

__all__ = ["VERSION_PATTERN", "parse", "Version", "InvalidVersion"]
__all__ = ["VERSION_PATTERN", "InvalidVersion", "Version", "parse"]

LocalType = Tuple[Union[int, str], ...]

Expand Down

0 comments on commit 4493dfc

Please sign in to comment.