From 7fe81411097cc1346be32d9cd05ea48c59b09dbb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=8Dtalo=20Epif=C3=A2nio?= Date: Sun, 3 Mar 2024 20:27:51 -0300 Subject: [PATCH] Fix mypy errors --- ipywatch/ipywatch.py | 8 ++++---- mypy.ini | 2 +- nbs/01_reacton.ipynb | 2 +- nbs/03_ipywatch.ipynb | 8 ++++---- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/ipywatch/ipywatch.py b/ipywatch/ipywatch.py index 111a08c..2f3cb58 100644 --- a/ipywatch/ipywatch.py +++ b/ipywatch/ipywatch.py @@ -4,7 +4,7 @@ __all__ = ['WidgetStateHistoryListener', 'Ipywatch'] # %% ../nbs/03_ipywatch.ipynb 3 -from typing import Any, Callable +from typing import Any, Callable, Optional import ipywidgets from comm.base_comm import BaseComm @@ -16,9 +16,9 @@ # %% ../nbs/03_ipywatch.ipynb 4 class WidgetStateHistoryListener: def __init__( - self, - history_size: int = 5, - on_state_change: Callable[[ipywidgets.Widget, Any], None]=None + self, + history_size: int = 5, + on_state_change: Optional[Callable[[ipywidgets.Widget, Any], None]] = None ): self.history_size = history_size self.history = WidgetStateHistory(history_size) diff --git a/mypy.ini b/mypy.ini index 7d28039..976ba02 100644 --- a/mypy.ini +++ b/mypy.ini @@ -1,2 +1,2 @@ [mypy] -method_assign=False \ No newline at end of file +ignore_missing_imports = True diff --git a/nbs/01_reacton.ipynb b/nbs/01_reacton.ipynb index 68be90e..4f3d536 100644 --- a/nbs/01_reacton.ipynb +++ b/nbs/01_reacton.ipynb @@ -50,7 +50,7 @@ " \n", " _original_render(self, element, container)\n", "\n", - "_RenderContext.render = _patched_render" + "_RenderContext.render = _patched_render # type: ignore" ] }, { diff --git a/nbs/03_ipywatch.ipynb b/nbs/03_ipywatch.ipynb index b75c42a..60b7e33 100644 --- a/nbs/03_ipywatch.ipynb +++ b/nbs/03_ipywatch.ipynb @@ -34,7 +34,7 @@ "outputs": [], "source": [ "#| exporti\n", - "from typing import Any, Callable\n", + "from typing import Any, Callable, Optional\n", "\n", "import ipywidgets\n", "from comm.base_comm import BaseComm\n", @@ -54,9 +54,9 @@ "#| export\n", "class WidgetStateHistoryListener:\n", " def __init__(\n", - " self, \n", - " history_size: int = 5, \n", - " on_state_change: Callable[[ipywidgets.Widget, Any], None]=None\n", + " self,\n", + " history_size: int = 5,\n", + " on_state_change: Optional[Callable[[ipywidgets.Widget, Any], None]] = None\n", " ):\n", " self.history_size = history_size\n", " self.history = WidgetStateHistory(history_size)\n",