|
12 | 12 | from __future__ import annotations |
13 | 13 |
|
14 | 14 | import warnings |
15 | | -from typing import Callable, Optional |
| 15 | +from typing import Callable, Optional, TypeAlias |
16 | 16 | from ctypes import * |
17 | 17 |
|
18 | 18 | # Import all the raw bindings |
19 | 19 | from . import webui_bindings as _raw |
20 | 20 |
|
21 | 21 |
|
22 | | - |
| 22 | +_FileHandlerCallback: TypeAlias = _raw.FILE_HANDLER_CB |
23 | 23 | # C function type for the file handler window |
24 | 24 | filehandler_window_callback = CFUNCTYPE(c_void_p, c_size_t, c_char_p, POINTER(c_int)) |
25 | 25 |
|
@@ -308,7 +308,7 @@ def script_client(self, script: str, timeout: int = 0, buffer_size: int = 4096) |
308 | 308 | # Initializing Result |
309 | 309 | res = JavaScript() |
310 | 310 |
|
311 | | - res.data = buffer.value.decode('utf-8', errors='ignore') |
| 311 | + res.data = buffer.value.decode('utf-8', errors='ignore') # type: ignore |
312 | 312 | res.error = not success |
313 | 313 | return res |
314 | 314 |
|
@@ -619,8 +619,8 @@ def __init__(self, window_id: Optional[int] = None): |
619 | 619 | self._cb_func_list: dict = {} |
620 | 620 |
|
621 | 621 | # gets used for both filehandler and filehandler_window, should wipe out the other just how it does in C |
622 | | - self._file_handler_cb: _raw.FILE_HANDLER_CB = None |
623 | | - self._buffers = [] |
| 622 | + self._file_handler_cb: _FileHandlerCallback = None |
| 623 | + self._buffers: list = [] |
624 | 624 |
|
625 | 625 | # -- dispatcher for function bindings ----------- |
626 | 626 | def _make_dispatcher(self): |
@@ -1051,7 +1051,7 @@ def send_raw(self, function: str, raw: Optional[c_void_p], size: int) -> None: |
1051 | 1051 | _raw.webui_send_raw( |
1052 | 1052 | c_size_t(self._window), |
1053 | 1053 | c_char_p(function.encode("utf-8")), |
1054 | | - c_void_p(raw), |
| 1054 | + c_void_p(raw), # type: ignore |
1055 | 1055 | c_size_t(size) |
1056 | 1056 | ) |
1057 | 1057 |
|
@@ -1397,7 +1397,7 @@ def script(self, script: str, timeout: int = 0, buffer_size: int = 4096) -> Java |
1397 | 1397 | # Initializing Result |
1398 | 1398 | res = JavaScript() |
1399 | 1399 |
|
1400 | | - res.data = buffer.value.decode('utf-8', errors='ignore') |
| 1400 | + res.data = buffer.value.decode('utf-8', errors='ignore') # type: ignore |
1401 | 1401 | res.error = not success |
1402 | 1402 | return res |
1403 | 1403 |
|
|
0 commit comments