Skip to content

Commit 64fb717

Browse files
committed
Run ruff fix
1 parent b8f4936 commit 64fb717

File tree

3 files changed

+8
-9
lines changed

3 files changed

+8
-9
lines changed

maxminddb/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ def open_database(
8080
# checking purposes, pretend it is one. (Ideally this would be a subclass
8181
# of, or share a common parent class with, the Python Reader
8282
# implementation.)
83-
return cast(Reader, _extension.Reader(database, mode))
83+
return cast("Reader", _extension.Reader(database, mode))
8484

8585

8686
__title__ = "maxminddb"

maxminddb/extension.pyi

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ from ipaddress import IPv4Address, IPv6Address
55
from os import PathLike
66
from typing import IO, Any, AnyStr, Optional, Union
77

8-
from maxminddb.const import MODE_AUTO
98
from maxminddb.types import Record
109

1110
class Reader:
@@ -18,7 +17,7 @@ class Reader:
1817
def __init__(
1918
self,
2019
database: Union[AnyStr, int, PathLike, IO],
21-
mode: int = MODE_AUTO,
20+
mode: int = ...,
2221
) -> None:
2322
"""Reader for the MaxMind DB file format
2423

tests/reader_test.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -176,10 +176,10 @@ def test_get_with_prefix_len(self) -> None:
176176

177177
for test in tests:
178178
with open_database(
179-
"tests/data/test-data/" + cast(str, test["file_name"]),
179+
"tests/data/test-data/" + cast("str", test["file_name"]),
180180
self.mode,
181181
) as reader:
182-
(record, prefix_len) = reader.get_with_prefix_len(cast(str, test["ip"]))
182+
(record, prefix_len) = reader.get_with_prefix_len(cast("str", test["ip"]))
183183

184184
self.assertEqual(
185185
prefix_len,
@@ -191,9 +191,9 @@ def test_get_with_prefix_len(self) -> None:
191191
record,
192192
test["expected_record"],
193193
"expected_record for "
194-
+ cast(str, test["ip"])
194+
+ cast("str", test["ip"])
195195
+ " in "
196-
+ cast(str, test["file_name"]),
196+
+ cast("str", test["file_name"]),
197197
)
198198

199199
def test_iterator(self) -> None:
@@ -249,7 +249,7 @@ def test_decoder(self) -> None:
249249
"tests/data/test-data/MaxMind-DB-test-decoder.mmdb",
250250
self.mode,
251251
)
252-
record = cast(dict, reader.get(self.ipf("::1.1.1.0")))
252+
record = cast("dict", reader.get(self.ipf("::1.1.1.0")))
253253

254254
self.assertEqual(record["array"], [1, 2, 3])
255255
self.assertEqual(record["boolean"], True)
@@ -724,7 +724,7 @@ def setUp(self) -> None:
724724
class TestOldReader(unittest.TestCase):
725725
def test_old_reader(self) -> None:
726726
reader = maxminddb.Reader("tests/data/test-data/MaxMind-DB-test-decoder.mmdb")
727-
record = cast(dict, reader.get("::1.1.1.0"))
727+
record = cast("dict", reader.get("::1.1.1.0"))
728728

729729
self.assertEqual(record["array"], [1, 2, 3])
730730
reader.close()

0 commit comments

Comments
 (0)