Skip to content

Commit 609aa01

Browse files
committed
ruff fixes
1 parent 6dbfec3 commit 609aa01

File tree

7 files changed

+18
-6
lines changed

7 files changed

+18
-6
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ An API to parse Tibia.com content into object oriented data.
33

44
No fetching is done by this module, you must provide the html content.
55

6+
7+
68
[![PyPI](https://img.shields.io/pypi/v/tibia.py.svg)](https://pypi.python.org/pypi/tibia.py/)
79
![GitHub commits since latest release (branch)](https://img.shields.io/github/commits-since/Galarzaa90/tibia.py/latest/main)
810
![PyPI - Python Version](https://img.shields.io/pypi/pyversions/tibia.py.svg)

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,7 @@ ignore = [
145145
"ANN401", # Dynamically typed expressions ({name}) are disallowed in `other`
146146
"PLR0913", # Too many arguments in function definition
147147
"PLR2004", # Magic value used in comparison, consider replacing `{number}` with a constant variable
148+
"PLW2901", # Outer {outer_kind} variable {name} overwritten by inner {inner_kind} target
148149
]
149150

150151
[tool.ruff.lint.per-file-ignores]

tests/tests_bazaar.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
FILE_BAZAAR_HISTORY = "characterBazaar/bazaarHistory.txt"
1414
FILE_AUCTION_FINISHED = "auction/auctionFinished.txt"
1515
FILE_AUCTION_UPGRADED_ITEMS = "auction/auctionWithUpgradedItems.txt"
16+
FILE_AUCTION_FRAGMENT_PROGRESS = "auction/auctionWithFragmentProgress.txt"
1617
FILE_AUCTION_NOT_FOUND = "auction/auctionNotFound.txt"
1718

1819

@@ -198,6 +199,13 @@ def test_auction_parser_from_content_with_upgraded_items(self):
198199

199200
self.assertEqual(2, auction.displayed_items[2].tier)
200201

202+
def test_auction_parser_from_content_with_fragment_progress(self):
203+
auction = AuctionParser.from_content(self.load_resource(FILE_AUCTION_UPGRADED_ITEMS))
204+
205+
self.assertIsNotNone(auction)
206+
207+
self.assertEqual(2, auction.displayed_items[2].tier)
208+
201209
def test_auction_parser_from_content_not_found(self):
202210
auction = AuctionParser.from_content(self.load_resource(FILE_AUCTION_NOT_FOUND))
203211

tibiapy/enums.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ def __str__(self):
7777
return self.name.lower()
7878

7979
@classmethod
80-
def validate(cls, v: Any):
80+
def validate(cls, v: Any) -> Self:
8181
e = try_enum(cls, v)
8282
if e is None:
8383
raise EnumValueError(cls, v)

tibiapy/errors.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ class InvalidContentError(TibiapyError):
3636
3737
"""
3838

39-
def __init__(self, message: str, original=None):
39+
def __init__(self, message: str, original: Exception = None):
4040
super().__init__(message)
4141
self.original = original
4242

@@ -58,7 +58,7 @@ class NetworkError(TibiapyError):
5858
5959
"""
6060

61-
def __init__(self, message, original=None, fetching_time=0):
61+
def __init__(self, message: str, original: Exception = None, fetching_time: float = 0.0):
6262
super().__init__(message)
6363
self.original = original
6464
self.fetching_time = fetching_time
@@ -95,11 +95,11 @@ def __init__(self, enum: type[Enum], value: Any) -> None:
9595
)
9696

9797
@property
98-
def names(self):
98+
def names(self) -> str:
9999
"""The valid names for the enum."""
100100
return ", ".join(e.name for e in self.enum)
101101

102102
@property
103-
def values(self):
103+
def values(self) -> str:
104104
"""The valid values for the enum."""
105105
return ", ".join(str(e.value) for e in self.enum)

tibiapy/models/fansite.py

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

34
from tibiapy.models import BaseModel

tibiapy/parsers/fansite.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
1+
"""Module containing the parser for supported and promoted fansites."""
22
import bs4
33

44
from tibiapy import InvalidContentError

0 commit comments

Comments
 (0)