Skip to content

Commit fb95126

Browse files
committed
[ruff] add flake8-bugbear and fixes
1 parent acf9a2d commit fb95126

File tree

3 files changed

+14
-4
lines changed

3 files changed

+14
-4
lines changed

pyproject.toml

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,13 +173,19 @@ select = [
173173
# pydocstyle
174174
"D",
175175
# pyupgrade
176-
"UP"
176+
"UP",
177+
# flake8-bandit
178+
"S",
179+
# flake8-bugbear
180+
"B",
181+
177182
]
178183
ignore = [
179184
# Missing docstring in magic method
180185
"D105",
181186
# Missing docstring in `__init__`
182187
"D107",
188+
183189
]
184190

185191

@@ -192,3 +198,7 @@ extend-ignore-names = ["assert*"]
192198
[tool.ruff.lint.pyupgrade]
193199
# Preserve types, even if a file imports `from __future__ import annotations`.
194200
keep-runtime-typing = true
201+
202+
[tool.ruff.lint.flake8-bugbear]
203+
# Allow default arguments like, e.g., `data: List[str] = fastapi.Query(None)`.
204+
extend-immutable-calls = ["fastapi.Depends", "fastapi.Query", "fastapi.Path"]

tibiapy/parsers/creature.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ def from_content(cls, content: str) -> BoostableBosses:
117117

118118
return BoostableBosses(boosted_boss=boosted_boss, bosses=entries)
119119
except (AttributeError, ValueError) as e:
120-
raise InvalidContent("content is not the boosted boss's library", e)
120+
raise InvalidContent("content is not the boosted boss's library", e) from e
121121

122122
@classmethod
123123
def boosted_boss_from_header(cls, content: str) -> BossEntry:
@@ -205,7 +205,7 @@ def from_content(cls, content: str) -> CreaturesSection:
205205

206206
return CreaturesSection(boosted_creature=boosted_creature, creatures=entries)
207207
except (AttributeError, ValueError) as e:
208-
raise InvalidContent("content is not the creature's library", e)
208+
raise InvalidContent("content is not the creature's library", e) from e
209209

210210

211211
class CreatureParser:

tibiapy/parsers/forum.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ def from_content(cls, content: str) -> CMPostArchive:
7575
start_date = cls._get_selected_date(start_month_selector, start_day_selector, start_year_selector)
7676
end_date = cls._get_selected_date(end_month_selector, end_day_selector, end_year_selector)
7777
except (AttributeError, ValueError) as e:
78-
raise errors.InvalidContent("content does not belong to the CM Post Archive in Tibia.com", e)
78+
raise errors.InvalidContent("content does not belong to the CM Post Archive in Tibia.com", e) from e
7979

8080
builder = CMPostArchiveBuilder().from_date(start_date).to_date(end_date)
8181
table = parsed_content.select_one("table.Table3")

0 commit comments

Comments
 (0)