Skip to content

Commit 954f36f

Browse files
committed
chore(mypy): Add typings for plugin
1 parent 1496f1d commit 954f36f

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

src/tmuxp/plugin.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
if t.TYPE_CHECKING:
3030
from libtmux.session import Session
3131
from libtmux.window import Window
32-
from typing_extensions import TypedDict, Unpack
32+
from typing_extensions import TypedDict, TypeGuard, Unpack
3333

3434
from ._types import PluginConfigSchema
3535

@@ -72,7 +72,7 @@ class Config(t.TypedDict):
7272
}
7373

7474

75-
def validate_plugin_config(config: "PluginConfigSchema") -> t.TypeGuard["Config"]:
75+
def validate_plugin_config(config: "PluginConfigSchema") -> "TypeGuard[Config]":
7676
return isinstance(config, dict)
7777

7878

@@ -82,7 +82,7 @@ def setup_plugin_config(
8282
new_config = config.copy()
8383
for default_key, default_value in default_config.items():
8484
if default_key not in new_config:
85-
new_config[default_key] = default_value
85+
new_config[default_key] = default_value # type:ignore
8686

8787
assert validate_plugin_config(new_config)
8888

@@ -204,7 +204,7 @@ def _pass_version_check(
204204

205205
return True
206206

207-
def before_workspace_builder(self, session: "Session"):
207+
def before_workspace_builder(self, session: "Session") -> None:
208208
"""
209209
Provide a session hook previous to creating the workspace.
210210
@@ -217,7 +217,7 @@ def before_workspace_builder(self, session: "Session"):
217217
session to hook into
218218
"""
219219

220-
def on_window_create(self, window: "Window"):
220+
def on_window_create(self, window: "Window") -> None:
221221
"""
222222
Provide a window hook previous to doing anything with a window.
223223
@@ -229,7 +229,7 @@ def on_window_create(self, window: "Window"):
229229
window to hook into
230230
"""
231231

232-
def after_window_finished(self, window: "Window"):
232+
def after_window_finished(self, window: "Window") -> None:
233233
"""
234234
Provide a window hook after creating the window.
235235
@@ -243,7 +243,7 @@ def after_window_finished(self, window: "Window"):
243243
window to hook into
244244
"""
245245

246-
def before_script(self, session: "Session"):
246+
def before_script(self, session: "Session") -> None:
247247
"""
248248
Provide a session hook after the workspace has been built.
249249
@@ -271,7 +271,7 @@ def before_script(self, session: "Session"):
271271
session to hook into
272272
"""
273273

274-
def reattach(self, session: "Session"):
274+
def reattach(self, session: "Session") -> None:
275275
"""
276276
Provide a session hook before reattaching to the session.
277277

0 commit comments

Comments
 (0)