Skip to content

Commit fba4c10

Browse files
committed
ruff manual fixes
1 parent 9eefb50 commit fba4c10

27 files changed

+129
-17
lines changed

pyproject.toml

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -142,10 +142,24 @@ rst-directives = [
142142
literal-inline-quotes = "double"
143143
type-checking-pydantic-enabled = true
144144

145+
[tool.ruff]
146+
exclude = [
147+
"__pycache__",
148+
".git/",
149+
"build/",
150+
".idea/",
151+
"venv/",
152+
"docs/",
153+
"logs/",
154+
"tests/",
155+
]
156+
157+
145158
[tool.ruff.per-file-ignores]
146-
"__init__.py" = ["F401", "F403"]
147-
"**/builders/*" = ["D101"]
159+
"__init__.py" = ["D104", "F401", "F403"]
160+
"**/builders/*" = ["D"]
148161
"tests/**" = ["D101"]
162+
"server.py" = ["D100", "D103"]
149163

150164

151165
[tool.ruff.lint]
@@ -159,8 +173,11 @@ select = [
159173
# pydocstyle
160174
"D",
161175
]
162-
exclude = [
163-
"D105"
176+
ignore = [
177+
# Missing docstring in magic method
178+
"D105",
179+
# Missing docstring in `__init__`
180+
"D107",
164181
]
165182

166183

requirements-testing.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
aioresponses
22
asynctest
33
coverage[toml]
4+
packaging

tibiapy/enums.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,7 @@ class BazaarType(StringEnum):
249249

250250
@property
251251
def subtopic(self):
252+
"""The subtopic argument for this Bazaar type."""
252253
return "currentcharactertrades" if self == self.CURRENT else "pastcharactertrades"
253254

254255

@@ -388,15 +389,18 @@ class NewsCategory(StringEnum):
388389

389390
@property
390391
def filter_name(self):
392+
"""The name of the filter parameter for this value."""
391393
return f"filter_{self.value}"
392394

393395
@property
394396
def big_icon_url(self):
397+
"""The URL to the big icon representing this category."""
395398
from tibiapy.urls import get_static_file_url
396399
return get_static_file_url("images", "global", "content", f"newsicon_{self.value}_big.gif")
397400

398401
@property
399402
def small_icon_url(self):
403+
"""The URL to the small icon representing this category."""
400404
from tibiapy.urls import get_static_file_url
401405
return get_static_file_url("images", "global", "content", f"newsicon_{self.value}_small.gif")
402406

@@ -410,10 +414,12 @@ class NewsType(StringEnum):
410414

411415
@property
412416
def filter_name(self):
417+
"""The filter parameter name for this value."""
413418
return f"filter_{self.value.split(' ')[-1].lower()}"
414419

415420
@property
416421
def filter_value(self):
422+
"""The filter parameter value for this value."""
417423
return self.value.split(" ")[-1].lower()
418424

419425

@@ -552,6 +558,7 @@ class Vocation(StringEnum):
552558

553559
@property
554560
def base(self):
561+
"""The base vocation of this vocation if promoted. If not promoted, the same value is returned."""
555562
if self == self.ELDER_DRUID:
556563
return self.DRUID
557564
elif self == self.MASTER_SORCERER:

tibiapy/errors.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,10 @@ def __init__(self, enum: Type[Enum], value: Any) -> None:
7979

8080
@property
8181
def names(self):
82+
"""The valid names for the enum."""
8283
return ", ".join(e.name for e in self.enum)
8384

8485
@property
8586
def values(self):
87+
"""The valid values for the enum."""
8688
return ", ".join(str(e.value) for e in self.enum)

tibiapy/models/bazaar.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
"""Models relatd to the character bazaar."""
12
import datetime
23
from abc import ABC, abstractmethod
34
from typing import Optional, List, Dict, TypeVar, Generic
@@ -516,6 +517,18 @@ class CharacterBazaar(PaginatedWithUrl[Auction]):
516517
"""The currently set filtering options."""
517518

518519
def get_page_url(self, page) -> str:
520+
"""Get the URL to a given page of the bazaar.
521+
522+
Parameters
523+
----------
524+
page: :class:`int`
525+
The desired page.
526+
527+
Returns
528+
-------
529+
:class:`str`
530+
The URL to the desired page.
531+
"""
519532
return get_bazaar_url(self.type, page, self.filters)
520533

521534
@property

tibiapy/models/character.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
"""Models related to characters."""
12
from __future__ import annotations
23

34
import datetime

tibiapy/models/creature.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
"""Models for creatures."""
12
from typing import List, Optional
23

34
from pydantic import computed_field

tibiapy/models/event.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
"""Models related to the event schedule calendar."""
12
import datetime
23
from typing import List, Optional
34

tibiapy/models/forum.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
"""Models related to the forums."""
12
import datetime
23
from typing import List, Optional
34

@@ -273,6 +274,7 @@ class ForumSection(BaseModel):
273274

274275
@property
275276
def url(self):
277+
"""The URL to this forum section."""
276278
return get_forum_section_url(self.section_id)
277279

278280

tibiapy/models/guild.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
"""Models for guilds and members."""
12
import datetime
23
from collections import defaultdict
34
from typing import Optional, List, Dict, OrderedDict

0 commit comments

Comments
 (0)