Skip to content

Commit acf9a2d

Browse files
committed
[ruff] add pyupgrade and fixes
1 parent fba4c10 commit acf9a2d

File tree

3 files changed

+11
-5
lines changed

3 files changed

+11
-5
lines changed

pyproject.toml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,8 @@ select = [
172172
"N",
173173
# pydocstyle
174174
"D",
175+
# pyupgrade
176+
"UP"
175177
]
176178
ignore = [
177179
# Missing docstring in magic method
@@ -186,3 +188,7 @@ max-line-length = 120
186188

187189
[tool.ruff.lint.pep8-naming]
188190
extend-ignore-names = ["assert*"]
191+
192+
[tool.ruff.lint.pyupgrade]
193+
# Preserve types, even if a file imports `from __future__ import annotations`.
194+
keep-runtime-typing = true

tibiapy/parsers/bazaar.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -349,7 +349,7 @@ def _parse_skills_table(cls, builder: AuctionDetailsBuilder, table):
349349
skills = []
350350
for row in rows:
351351
cols = row.select("td")
352-
name_c, level_c, progress_c = [c.text for c in cols]
352+
name_c, level_c, progress_c = (c.text for c in cols)
353353
level = int(level_c)
354354
progress = float(progress_c.replace("%", ""))
355355
skills.append(SkillEntry(name=name_c, level=level, progress=progress))
@@ -372,7 +372,7 @@ def _parse_blessings_table(cls, builder: AuctionDetailsBuilder, table):
372372
blessings = []
373373
for row in rows:
374374
cols = row.select("td")
375-
amount_c, name_c = [c.text for c in cols]
375+
amount_c, name_c = (c.text for c in cols)
376376
amount = int(amount_c.replace("x", ""))
377377
blessings.append(BlessingEntry(name=name_c, amount=amount))
378378

@@ -424,7 +424,7 @@ def _parse_charms_table(cls, builder: AuctionDetailsBuilder, table):
424424
if len(cols) != 2:
425425
continue
426426

427-
cost_c, name_c = [c.text for c in cols]
427+
cost_c, name_c = (c.text for c in cols)
428428
cost = parse_integer(cost_c.replace("x", ""))
429429
charms.append(CharmEntry(name=name_c, cost=cost))
430430

@@ -476,7 +476,7 @@ def _parse_bestiary_table(cls, builder: AuctionDetailsBuilder, table: bs4.Tag, b
476476
if len(cols) != 3:
477477
continue
478478

479-
step_c, kills_c, name_c = [c.text for c in cols]
479+
step_c, kills_c, name_c = (c.text for c in cols)
480480
kills = parse_integer(kills_c.replace("x", ""))
481481
step = int(step_c)
482482
bestiary.append(BestiaryEntry(name=name_c, kills=kills, step=step))

tibiapy/parsers/highscores.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ def _parse_entry(cls, builder, cols):
155155
cols: :class:`bs4.ResultSet`
156156
The list of columns for that entry.
157157
"""
158-
rank, name, *values = [clean_text(c) for c in cols]
158+
rank, name, *values = (clean_text(c) for c in cols)
159159
rank = int(rank)
160160
extra = None
161161
if builder._category == HighscoresCategory.LOYALTY_POINTS:

0 commit comments

Comments
 (0)