Skip to content

Commit

Permalink
ci: enable pyupgrade rules in ruff (#921)
Browse files Browse the repository at this point in the history
  • Loading branch information
epenet authored Nov 18, 2024
1 parent 05abd5a commit 8c1208d
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 4 deletions.
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ extend-select = [
"B", # flake8-bugbear
"C4", # flake8-comprehensions
"I", # isort
"UP", # pyupgrade
]

[build-system]
Expand Down
2 changes: 1 addition & 1 deletion src/syrupy/extensions/amber/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def _read_snapshot_collection(self, snapshot_location: str) -> "SnapshotCollecti
return self.serializer_class.read_file(snapshot_location)

@classmethod
@lru_cache()
@lru_cache
def __cacheable_read_snapshot(
cls, snapshot_location: str, cache_key: str
) -> "SnapshotCollection":
Expand Down
2 changes: 1 addition & 1 deletion src/syrupy/extensions/amber/serializer.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ def __read_file_with_markers(
missing_version = True

try:
with open(filepath, "r", encoding=TEXT_ENCODING, newline=None) as f:
with open(filepath, encoding=TEXT_ENCODING, newline=None) as f:
for line_no, line in enumerate(f):
if line.startswith(cls._marker_prefix):
marker_key, *marker_rest = line[marker_offset:].split(
Expand Down
5 changes: 3 additions & 2 deletions src/syrupy/report.py
Original file line number Diff line number Diff line change
Expand Up @@ -359,8 +359,9 @@ def lines(self) -> Iterator[str]:
path_to_file = filepath

unused_snapshots = ", ".join(map(bold, sorted(snapshots)))
yield warning_style(gettext(base_message)) + " {} ({})".format(
unused_snapshots, path_to_file
yield (
warning_style(gettext(base_message))
+ f" {unused_snapshots} ({path_to_file})"
)
if not self.update_snapshots:
message = gettext(
Expand Down

0 comments on commit 8c1208d

Please sign in to comment.