Skip to content

Commit e1af249

Browse files
authored
chore: address mypy warnings
Signed-off-by: MichaIng <micha@dietpi.com>
1 parent ff3fa7f commit e1af249

File tree

19 files changed

+107
-149
lines changed

19 files changed

+107
-149
lines changed

.github/workflows/test_python.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ jobs:
4242
- run: python3 -m build
4343
- run: python3 -m pip install .
4444
- run: mkdir --parents --verbose .mypy_cache
45-
- run: mypy --ignore-missing-imports --install-types --non-interactive --exclude build/ . || true
45+
- run: mypy --ignore-missing-imports --install-types --non-interactive --exclude build/ .
4646
- run: pytest --ignore=tests/test_utils/test_mjpeg.py
4747
--ignore=tests/test_utils/test_rtmp.py . || true
4848
- run: pytest --fixtures tests/test_utils/test_mjpeg.py || true

motioneye/config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@
5959
]
6060

6161
_main_config_cache = None
62-
_camera_config_cache = {}
62+
_camera_config_cache: dict = {}
6363
_camera_ids_cache = None
6464
_additional_section_funcs = []
6565
_additional_config_funcs = []

motioneye/handlers/config.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -406,7 +406,8 @@ def _handle_get_config_response(
406406
# do not add this camera to the list if admin-only, but reduce the async counter so listing can finish
407407
if admin_only and self.current_user != 'admin':
408408
length[0] -= 1
409-
return self.check_finished(cameras, length)
409+
self.check_finished(cameras, length)
410+
return
410411

411412
if not resp.remote_ui_config['enabled'] and local_config['@enabled']:
412413
# if a remote camera is disabled, make sure it's disabled locally as well
@@ -422,7 +423,7 @@ def _handle_get_config_response(
422423

423424
cameras.append(resp.remote_ui_config)
424425

425-
return self.check_finished(cameras, length)
426+
self.check_finished(cameras, length)
426427

427428
@BaseHandler.auth()
428429
async def list(self):

motioneye/locale/motioneye.js.pot

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ msgid ""
88
msgstr ""
99
"Project-Id-Version: PACKAGE VERSION\n"
1010
"Report-Msgid-Bugs-To: \n"
11-
"POT-Creation-Date: 2026-02-03 17:02+0000\n"
11+
"POT-Creation-Date: 2026-02-03 23:54+0000\n"
1212
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
1313
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
1414
"Language-Team: LANGUAGE <LL@li.org>\n"

motioneye/locale/motioneye.pot

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ msgid ""
88
msgstr ""
99
"Project-Id-Version: PROJECT VERSION\n"
1010
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
11-
"POT-Creation-Date: 2026-02-03 17:02+0000\n"
11+
"POT-Creation-Date: 2026-02-03 23:54+0000\n"
1212
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
1313
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
1414
"Language-Team: LANGUAGE <LL@li.org>\n"
@@ -37,67 +37,67 @@ msgstr ""
3737
msgid "URLs are not allowed to contain caret ^, semicolon ;, or apostrophe '"
3838
msgstr ""
3939

40-
#: motioneye/server.py:232
40+
#: motioneye/server.py:233
4141
msgid "interrompa signalo ricevita, fermanta …"
4242
msgstr ""
4343

44-
#: motioneye/server.py:276
44+
#: motioneye/server.py:277
4545
msgid "smb-akcioj postulas radikajn privilegiojn"
4646
msgstr ""
4747

48-
#: motioneye/server.py:283
48+
#: motioneye/server.py:284
4949
msgid "bonvolu instali tornado version 3.1 aŭ pli"
5050
msgstr ""
5151

52-
#: motioneye/server.py:290
52+
#: motioneye/server.py:291
5353
msgid "bonvolu instali jinja2"
5454
msgstr ""
5555

56-
#: motioneye/server.py:297
56+
#: motioneye/server.py:298
5757
msgid "bonvolu instali pillow aŭ PIL"
5858
msgstr ""
5959

60-
#: motioneye/server.py:304
60+
#: motioneye/server.py:305
6161
msgid "bonvolu instali pycurl"
6262
msgstr ""
6363

64-
#: motioneye/server.py:422
64+
#: motioneye/server.py:423
6565
msgid "saluton! ĉi tio estas motionEye-servilo "
6666
msgstr ""
6767

68-
#: motioneye/server.py:437
68+
#: motioneye/server.py:438
6969
msgid "purigado komenciĝis"
7070
msgstr ""
7171

72-
#: motioneye/server.py:439
72+
#: motioneye/server.py:440
7373
msgid "wsswitch komenciĝis"
7474
msgstr ""
7575

76-
#: motioneye/server.py:442
76+
#: motioneye/server.py:443
7777
msgid "taskoj komenciĝis"
7878
msgstr ""
7979

80-
#: motioneye/server.py:446
80+
#: motioneye/server.py:447
8181
msgid "mjpg klienta rubo-kolektanto komenciĝis"
8282
msgstr ""
8383

84-
#: motioneye/server.py:464
84+
#: motioneye/server.py:465
8585
msgid "servilo komenciĝis"
8686
msgstr ""
8787

88-
#: motioneye/server.py:470
88+
#: motioneye/server.py:471
8989
msgid "servilo haltis"
9090
msgstr ""
9191

92-
#: motioneye/server.py:472
92+
#: motioneye/server.py:473
9393
msgid "taskoj haltis"
9494
msgstr ""
9595

96-
#: motioneye/server.py:480
96+
#: motioneye/server.py:481
9797
msgid "motion haltis"
9898
msgstr ""
9999

100-
#: motioneye/server.py:485
100+
#: motioneye/server.py:486
101101
msgid "adiaŭ!"
102102
msgstr ""
103103

@@ -920,7 +920,7 @@ msgstr ""
920920

921921
#: motioneye/templates/main.html:780 motioneye/templates/main.html:893
922922
#: motioneye/templates/main.html:968 motioneye/templates/main.html:1097
923-
#: motioneye/utils/dtconv.py:146 motioneye/utils/dtconv.py:149
923+
#: motioneye/utils/dtconv.py:154 motioneye/utils/dtconv.py:157
924924
msgid "sekundoj"
925925
msgstr ""
926926

@@ -1048,7 +1048,7 @@ msgstr ""
10481048
msgid "Filmoj Vivdaŭro"
10491049
msgstr ""
10501050

1051-
#: motioneye/templates/main.html:912 motioneye/utils/dtconv.py:125
1051+
#: motioneye/templates/main.html:912 motioneye/utils/dtconv.py:133
10521052
msgid "tagoj"
10531053
msgstr ""
10541054

@@ -1509,46 +1509,46 @@ msgstr ""
15091509
msgid "Difinas, ĉu moviĝodetekto devas esti aktiva dum aŭ ekster la laborista horaro."
15101510
msgstr ""
15111511

1512-
#: motioneye/utils/dtconv.py:26 motioneye/utils/dtconv.py:65
1512+
#: motioneye/utils/dtconv.py:34 motioneye/utils/dtconv.py:73
15131513
msgid "neniam"
15141514
msgstr ""
15151515

1516-
#: motioneye/utils/dtconv.py:113
1516+
#: motioneye/utils/dtconv.py:121
15171517
msgid "tago"
15181518
msgstr ""
15191519

1520-
#: motioneye/utils/dtconv.py:116
1520+
#: motioneye/utils/dtconv.py:124
15211521
msgid "semajno"
15221522
msgstr ""
15231523

1524-
#: motioneye/utils/dtconv.py:119
1524+
#: motioneye/utils/dtconv.py:127
15251525
msgid "monato"
15261526
msgstr ""
15271527

1528-
#: motioneye/utils/dtconv.py:122
1528+
#: motioneye/utils/dtconv.py:130
15291529
msgid "jaro"
15301530
msgstr ""
15311531

1532-
#: motioneye/utils/dtconv.py:129
1532+
#: motioneye/utils/dtconv.py:137
15331533
msgid "horo"
15341534
msgstr ""
15351535

1536-
#: motioneye/utils/dtconv.py:132
1536+
#: motioneye/utils/dtconv.py:140
15371537
msgid "horoj"
15381538
msgstr ""
15391539

1540-
#: motioneye/utils/dtconv.py:136
1540+
#: motioneye/utils/dtconv.py:144
15411541
msgid "minuto"
15421542
msgstr ""
15431543

1544-
#: motioneye/utils/dtconv.py:139
1544+
#: motioneye/utils/dtconv.py:147
15451545
msgid "minutoj"
15461546
msgstr ""
15471547

1548-
#: motioneye/utils/dtconv.py:143
1548+
#: motioneye/utils/dtconv.py:151
15491549
msgid "sekundo"
15501550
msgstr ""
15511551

1552-
#: motioneye/utils/dtconv.py:153
1552+
#: motioneye/utils/dtconv.py:161
15531553
msgid "minus"
15541554
msgstr ""

motioneye/mediafiles.py

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@
9696
}
9797

9898
# a cache of prepared files (whose preparing time is significant)
99-
_prepared_files = {}
99+
_prepared_files: dict = {}
100100

101101
_timelapse_process = None
102102
_timelapse_data = None
@@ -105,7 +105,10 @@
105105

106106

107107
def _list_media_files(
108-
base_path: str, exts: typing.List[str], sub_path: str = None, with_stat: bool = True
108+
base_path: str,
109+
exts: typing.List[str],
110+
sub_path: str | None = None,
111+
with_stat: bool = True,
109112
) -> typing.List[tuple]:
110113
# Determine scan path based on sub_path parameter
111114
if sub_path is not None:
@@ -416,7 +419,9 @@ def cleanup_media(media_type: str) -> None:
416419
logging.debug(
417420
f'calling _remove_older_files: {cloud_enabled} {clean_cloud_enabled} {clean_cloud_info}'
418421
)
419-
_remove_older_files(target_dir, preserve_moment, clean_cloud_info, exts=exts)
422+
_remove_older_files(
423+
target_dir, preserve_moment, clean_cloud_info or {}, exts=exts
424+
)
420425

421426

422427
def make_movie_preview(camera_config: dict, full_path: str) -> typing.Union[str, None]:
@@ -489,9 +494,12 @@ def make_movie_preview(camera_config: dict, full_path: str) -> typing.Union[str,
489494

490495

491496
def list_media(
492-
camera_config: dict, media_type: str, prefix=None, with_stat: bool = True
497+
camera_config: dict,
498+
media_type: str,
499+
prefix: str | None = None,
500+
with_stat: bool = True,
493501
) -> typing.Awaitable:
494-
fut = Future()
502+
fut: Future = Future()
495503
target_dir = camera_config.get('target_dir')
496504

497505
if media_type == 'picture':
@@ -576,7 +584,7 @@ def get_media_content(camera_config, path, media_type):
576584
def get_zipped_content(
577585
camera_config: dict, media_type: str, group: str
578586
) -> typing.Awaitable:
579-
fut = Future()
587+
fut: Future = Future()
580588
target_dir = camera_config.get('target_dir')
581589

582590
if media_type == 'picture':

motioneye/mjpgclient.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
class MjpgClient(IOStream):
3333
_FPS_LEN = 10
3434

35-
clients = {} # dictionary of clients indexed by camera id
35+
clients: dict = {} # dictionary of clients indexed by camera id
3636
_last_erroneous_close_time = (
3737
0 # helps detecting erroneous connections and restart motion
3838
)
@@ -186,7 +186,7 @@ def _on_connect(self, future: Future) -> None:
186186

187187
self._seek_http()
188188

189-
def _seek_http(self, future: Future = False) -> None:
189+
def _seek_http(self, future: Future | None = None) -> None:
190190
result, _ = self._get_future_result(future) if future else (True, False)
191191

192192
if not result or self._check_error():

motioneye/monitor.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@
2525

2626
DEFAULT_INTERVAL = 1 # seconds
2727

28-
_monitor_info_cache_by_camera_id = {}
29-
_last_call_time_by_camera_id = {}
30-
_interval_by_camera_id = {}
28+
_monitor_info_cache_by_camera_id: dict = {}
29+
_last_call_time_by_camera_id: dict = {}
30+
_interval_by_camera_id: dict = {}
3131

3232

3333
def get_monitor_info(camera_id):

0 commit comments

Comments
 (0)