Skip to content

Commit

Permalink
Fix mypy errors
Browse files Browse the repository at this point in the history
  • Loading branch information
itepifanio committed Mar 3, 2024
1 parent 5465ea3 commit 7fe8141
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
8 changes: 4 additions & 4 deletions ipywatch/ipywatch.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion mypy.ini
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
[mypy]
method_assign=False
ignore_missing_imports = True
2 changes: 1 addition & 1 deletion nbs/01_reacton.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
" \n",
" _original_render(self, element, container)\n",
"\n",
"_RenderContext.render = _patched_render"
"_RenderContext.render = _patched_render # type: ignore"
]
},
{
Expand Down
8 changes: 4 additions & 4 deletions nbs/03_ipywatch.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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",
Expand Down

0 comments on commit 7fe8141

Please sign in to comment.