summaryrefslogtreecommitdiff
path: root/poezio/core/structs.py
diff options
context:
space:
mode:
authormathieui <mathieui@mathieui.net>2021-03-14 22:31:22 +0100
committermathieui <mathieui@mathieui.net>2021-04-02 17:44:36 +0200
commit4b198be9771594a28824cc082e737fe15ab681ec (patch)
tree01de648647136734d176ba0fa33e96a61bbafc88 /poezio/core/structs.py
parentbc4f4f1e0766aedb6b0e9f3df90fee9ea841786c (diff)
downloadpoezio-4b198be9771594a28824cc082e737fe15ab681ec.tar.gz
poezio-4b198be9771594a28824cc082e737fe15ab681ec.tar.bz2
poezio-4b198be9771594a28824cc082e737fe15ab681ec.tar.xz
poezio-4b198be9771594a28824cc082e737fe15ab681ec.zip
fix: tons of type errors
Diffstat (limited to 'poezio/core/structs.py')
-rw-r--r--poezio/core/structs.py10
1 files changed, 8 insertions, 2 deletions
diff --git a/poezio/core/structs.py b/poezio/core/structs.py
index e4d42551..31d31339 100644
--- a/poezio/core/structs.py
+++ b/poezio/core/structs.py
@@ -1,8 +1,12 @@
"""
Module defining structures useful to the core class and related methods
"""
+from __future__ import annotations
from dataclasses import dataclass
-from typing import Any, Callable, List, Dict
+from typing import Any, Callable, List, TYPE_CHECKING, Optional
+
+if TYPE_CHECKING:
+ from poezio import windows
__all__ = [
'Command',
@@ -34,6 +38,7 @@ class Completion:
A completion result essentially currying the input completion call.
"""
__slots__ = ['func', 'args', 'kwargs', 'comp_list']
+
def __init__(
self,
func: Callable[..., Any],
@@ -49,11 +54,12 @@ class Completion:
def run(self):
return self.func(self.comp_list, *self.args, **self.kwargs)
+
@dataclass
class Command:
__slots__ = ('func', 'desc', 'comp', 'short_desc', 'usage')
func: Callable[..., Any]
desc: str
- comp: Callable[['windows.Input'], Completion]
+ comp: Optional[Callable[['windows.Input'], Completion]]
short_desc: str
usage: str