Skip to content

Commit b8f4936

Browse files
committed
Switch to ruff for formatting
1 parent 08185fc commit b8f4936

File tree

4 files changed

+156
-188
lines changed

4 files changed

+156
-188
lines changed

maxminddb/reader.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -185,8 +185,11 @@ def _generate_children(self, node, depth, ip_acc) -> Iterator:
185185
ip_acc <<= bits - depth
186186
if ip_acc <= _IPV4_MAX_NUM and bits == 128:
187187
depth -= 96
188-
yield ipaddress.ip_network((ip_acc, depth)), self._resolve_data_pointer(
189-
node,
188+
yield (
189+
ipaddress.ip_network((ip_acc, depth)),
190+
self._resolve_data_pointer(
191+
node,
192+
),
190193
)
191194
elif node < node_count:
192195
left = self._read_node(node, 0)

pyproject.toml

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ dev = [
3535
"pytest>=8.3.5",
3636
]
3737
lint = [
38-
"black>=25.1.0",
3938
"flake8>=7.2.0",
4039
"mypy>=1.15.0",
4140
"pylint>=3.3.6",
@@ -57,11 +56,6 @@ packages = ["maxminddb"]
5756
[tool.setuptools.package-data]
5857
maxminddb = ["extension.pyi", "py.typed"]
5958

60-
[tool.black]
61-
# src is showing up in our GitHub linting builds. It seems to
62-
# contain deps.
63-
extend-exclude = '^/src/'
64-
6559
[tool.ruff.lint]
6660
select = ["ALL"]
6761
ignore = [
@@ -71,9 +65,6 @@ ignore = [
7165
# documenting magic methods
7266
"D105",
7367

74-
# Line length. We let black handle this for now.
75-
"E501",
76-
7768
# Don't bother with future imports for type annotations
7869
"FA100",
7970

@@ -115,7 +106,7 @@ dependency_groups = [
115106
"lint",
116107
]
117108
commands = [
118-
["black", "--check", "--diff", "."],
109+
["ruff", "format", "--check", "--diff", "."],
119110
["flake8", "maxminddb"],
120111
["mypy", "maxminddb", "tests"],
121112
["pylint", "maxminddb"],

tests/reader_test.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ def test_iterator(self) -> None:
239239

240240
for record_size in [24, 28, 32]:
241241
for test in tests:
242-
f = f'tests/data/test-data/MaxMind-DB-test-{test["database"]}-{record_size}.mmdb'
242+
f = f"tests/data/test-data/MaxMind-DB-test-{test['database']}-{record_size}.mmdb"
243243
reader = open_database(f, self.mode)
244244
networks = [str(n) for (n, _) in reader]
245245
self.assertEqual(networks, test["expected"], f)
@@ -454,7 +454,8 @@ def test_double_close(self) -> None:
454454
)
455455
reader.close()
456456
self.assertIsNone(
457-
reader.close(), "Double close does not throw an exception" # type: ignore
457+
reader.close(),
458+
"Double close does not throw an exception", # type: ignore
458459
)
459460

460461
def test_closed_get(self) -> None:

0 commit comments

Comments
 (0)