type-checking fix

This commit is contained in:
Roman Trapeznikov 2020-08-02 15:28:11 +03:00
parent 6a2471cf77
commit 448eafd13f
No known key found for this signature in database
GPG Key ID: 827DD41DACE1E018

View File

@ -30,7 +30,7 @@ from ba import charstr
from ba import SpecialChar as SpCh
if TYPE_CHECKING:
from typing import List, Tuple, Optional, Type
from typing import List, Tuple, Optional
class OnScreenKeyboardWindow(ba.Window):
@ -242,13 +242,13 @@ class OnScreenKeyboardWindow(ba.Window):
self._refresh()
def _get_keyboard(self) -> Type[ba.Keyboard]:
def _get_keyboard(self) -> ba.Keyboard:
assert ba.app.metascan is not None
path = ba.app.metascan.keyboards[self._keyboard_index]
classname = path.split('.')[-1]
module = path[:-len(classname) - 1]
keyboard = getattr(__import__(module), classname)
assert issubclass(keyboard, ba.Keyboard)
keyboard = getattr(__import__(module), classname)()
assert isinstance(keyboard, ba.Keyboard)
return keyboard
def _refresh(self) -> None: