diff --git a/PyPI/Package/pyproject.toml b/PyPI/Package/pyproject.toml index e5476af..b0145ff 100644 --- a/PyPI/Package/pyproject.toml +++ b/PyPI/Package/pyproject.toml @@ -15,6 +15,7 @@ classifiers = [ "Programming Language :: Python :: 3", "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", + "Typing :: Typed", ] [project.urls] diff --git a/PyPI/Package/src/webui/load_library.py b/PyPI/Package/src/webui/load_library.py index 3f59730..a849fb3 100644 --- a/PyPI/Package/src/webui/load_library.py +++ b/PyPI/Package/src/webui/load_library.py @@ -56,7 +56,7 @@ def _download_library(): # Load WebUI Dynamic Library -def load_library() -> CDLL: +def load_library() -> CDLL | None: library: CDLL | None = None lib_path = _get_library_path() if not os.path.exists(lib_path): @@ -87,4 +87,4 @@ def load_library() -> CDLL: else: print("Unsupported OS") - return library \ No newline at end of file + return library diff --git a/PyPI/Package/src/webui/py.typed b/PyPI/Package/src/webui/py.typed new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/PyPI/Package/src/webui/py.typed @@ -0,0 +1 @@ + diff --git a/PyPI/Package/src/webui/webui.py b/PyPI/Package/src/webui/webui.py index 750814c..7d2aa02 100644 --- a/PyPI/Package/src/webui/webui.py +++ b/PyPI/Package/src/webui/webui.py @@ -12,14 +12,13 @@ from __future__ import annotations import warnings -from typing import Callable, Optional +from typing import Any, Callable, Optional, TypeAlias from ctypes import * # Import all the raw bindings from . import webui_bindings as _raw - # C function type for the file handler window filehandler_window_callback = CFUNCTYPE(c_void_p, c_size_t, c_char_p, POINTER(c_int)) @@ -308,7 +307,7 @@ def script_client(self, script: str, timeout: int = 0, buffer_size: int = 4096) # Initializing Result res = JavaScript() - res.data = buffer.value.decode('utf-8', errors='ignore') + res.data = buffer.value.decode('utf-8', errors='ignore') # type: ignore res.error = not success return res @@ -619,8 +618,8 @@ def __init__(self, window_id: Optional[int] = None): self._cb_func_list: dict = {} # gets used for both filehandler and filehandler_window, should wipe out the other just how it does in C - self._file_handler_cb: _raw.FILE_HANDLER_CB = None - self._buffers = [] + self._file_handler_cb: Any = None + self._buffers: list = [] # -- dispatcher for function bindings ----------- def _make_dispatcher(self): @@ -1051,7 +1050,7 @@ def send_raw(self, function: str, raw: Optional[c_void_p], size: int) -> None: _raw.webui_send_raw( c_size_t(self._window), c_char_p(function.encode("utf-8")), - c_void_p(raw), + c_void_p(raw), # type: ignore c_size_t(size) ) @@ -1397,7 +1396,7 @@ def script(self, script: str, timeout: int = 0, buffer_size: int = 4096) -> Java # Initializing Result res = JavaScript() - res.data = buffer.value.decode('utf-8', errors='ignore') + res.data = buffer.value.decode('utf-8', errors='ignore') # type: ignore res.error = not success return res