Skip to content

Commit ac92d95

Browse files
authored
Add mypy (#95)
2 parents 264e5c9 + 22f54c0 commit ac92d95

File tree

3 files changed

+13
-9
lines changed

3 files changed

+13
-9
lines changed

requirements-mypy.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
mypy==1.17.1
2+
pygame
3+
types-tqdm

src/osmviz/manager.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
try:
4646
from tqdm import tqdm
4747
except ImportError:
48-
tqdm = None
48+
tqdm = None # type: ignore[assignment,misc]
4949

5050

5151
class ImageManager:
@@ -375,7 +375,7 @@ def create_osm_image(self, bounds, zoom):
375375
self.manager.prepare_image(pix_width, pix_height)
376376
total = (1 + max_x - min_x) * (1 + max_y - min_y)
377377

378-
if tqdm:
378+
if tqdm: # type: ignore[truthy-function]
379379
pbar = tqdm(desc="Fetching tiles", total=total, unit="tile")
380380
else:
381381
print(f"Fetching {total} tiles...")
@@ -386,9 +386,9 @@ def create_osm_image(self, bounds, zoom):
386386
x_off = self.tile_size * (x - min_x)
387387
y_off = self.tile_size * (y - min_y)
388388
self.manager.paste_image_file(f_name, (x_off, y_off))
389-
if tqdm:
389+
if tqdm: # type: ignore[truthy-function]
390390
pbar.update()
391-
if tqdm:
391+
if tqdm: # type: ignore[truthy-function]
392392
pbar.close()
393393
else:
394394
print("... done.")

tox.ini

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ requires =
33
tox>=4.2
44
env_list =
55
lint
6+
mypy
67
py{py3, 314, 313, 312, 311, 310, 39}
78

89
[testenv]
@@ -33,12 +34,12 @@ pass_env =
3334
commands =
3435
pre-commit run --all-files --show-diff-on-failure
3536

36-
[testenv:py310]
37-
deps =
38-
tqdm
39-
4037
[testenv:mypy]
4138
deps =
42-
mypy==1.11.2
39+
-r requirements-mypy.txt
4340
commands =
4441
mypy . {posargs}
42+
43+
[testenv:py310]
44+
deps =
45+
tqdm

0 commit comments

Comments
 (0)