diff --git a/pyproject.toml b/pyproject.toml index 6ad62b6..92d3f5c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -37,14 +37,12 @@ mkdocs = "^1.5.3" mkdocstrings = {extras = ["python"], version = "^0.23.0"} mkdocs-material = "^9.4.8" - [tool.poetry.group.gui.dependencies] flet = "^0.11.0" psutil = "^5.9.6" +types-psutil = "^5.9.5.17" bidict = "^0.22.1" - - [tool.poetry.scripts] node_deployer = "node_deployer.__main__:main" debug_node_deployer = "node_deployer.__main__:debug" @@ -54,6 +52,17 @@ build_docs = "scripts.docs:main" requires = ["poetry-core"] build-backend = "poetry.core.masonry.api" +[tool.mypy] +check_untyped_defs = true + +[[tool.mypy.overrides]] +module="flet.*" +ignore_missing_imports = true + +[[tool.mypy.overrides]] +module="flet_core.*" +ignore_missing_imports = true + [tool.black] line-length = 100 diff --git a/src/node_deployer/py.typed b/src/node_deployer/py.typed new file mode 100644 index 0000000..e69de29 diff --git a/src/node_deployer_gui/__init__.py b/src/node_deployer_gui/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/src/node_deployer_gui/__main__.py b/src/node_deployer_gui/__main__.py index d929178..509e9a9 100644 --- a/src/node_deployer_gui/__main__.py +++ b/src/node_deployer_gui/__main__.py @@ -8,4 +8,4 @@ def main(): if __name__ == "__main__": - main() \ No newline at end of file + main() diff --git a/src/node_deployer_gui/disk_dropdown.py b/src/node_deployer_gui/disk_dropdown.py index cfac6bc..fb726a1 100644 --- a/src/node_deployer_gui/disk_dropdown.py +++ b/src/node_deployer_gui/disk_dropdown.py @@ -20,11 +20,11 @@ def disk_dropdown(**kwargs) -> Tuple[ft.Dropdown, ft.Row]: options=get_disk_options(), **kwargs, ) - - def refresh_dropdown(_): + + def refresh_dropdown(*_) -> None: dropdown.options = get_disk_options() dropdown.update() - + refresh_button = ft.IconButton( icon="refresh", tooltip="Refresh disk list", @@ -34,4 +34,4 @@ def disk_dropdown(**kwargs) -> Tuple[ft.Dropdown, ft.Row]: controls=[dropdown, refresh_button], alignment=ft.MainAxisAlignment.CENTER, ) - return dropdown, element \ No newline at end of file + return dropdown, element diff --git a/src/node_deployer_gui/gui.py b/src/node_deployer_gui/gui.py index 5cf089d..a33161a 100644 --- a/src/node_deployer_gui/gui.py +++ b/src/node_deployer_gui/gui.py @@ -28,7 +28,7 @@ def main(page: ft.Page) -> None: swarm_token = ft.TextField(label="Swarm Token", text_align=ft.TextAlign.LEFT) # This wrapper validates the value of the field before passing it to the function - def validate_value(func): + def validate_value(func: Callable) -> Callable: @wraps(func) def wrapped(): out = func() @@ -79,7 +79,7 @@ def main(page: ft.Page) -> None: ) # This button triggers the confirmation popup before calling the disk creation function - def confirm_disk_creation(_): + def confirm_disk_creation(*_): # Fetch the values of the fields disk_val: str = field_fetch_map[disk]() hostname_val: str = field_fetch_map[hostname]() @@ -92,12 +92,12 @@ def main(page: ft.Page) -> None: # Also: nested closures, eww. It feels dirty, but maintains the functional style # and most of its benefits. I'm tempting the functional gods to punish me with # side-effects here though... - def close_dlg(_): + def close_dlg(*_) -> None: dlg.open = False page.update() # This closure is called when the confirm disk creation button is pressed - def trigger_disk_creation(_): + def trigger_disk_creation(*_) -> None: dlg.title = None dlg.content = ft.Row( controls=[ diff --git a/src/node_deployer_gui/py.typed b/src/node_deployer_gui/py.typed new file mode 100644 index 0000000..e69de29