fix: typing imports for 3.9

This commit is contained in:
mathieui 2021-04-11 14:05:56 +02:00
parent 93daf17324
commit b729de9147
3 changed files with 10 additions and 10 deletions

View file

@ -3,15 +3,7 @@ from typing import Callable, List, Optional
from poezio.core.commands import CommandCore from poezio.core.commands import CommandCore
from poezio.core.completions import CompletionCore from poezio.core.completions import CompletionCore
from poezio.plugin_manager import PluginManager from poezio.plugin_manager import PluginManager
from poezio.types import TypedDict
try:
from typing_extensions import TypedDict
except ImportError:
from sys import version_info
if version_info < (3, 9):
raise
from typing import TypedDict
CommandDict = TypedDict( CommandDict = TypedDict(

View file

@ -20,7 +20,7 @@ from poezio.config import config
from poezio.xhtml import clean_text from poezio.xhtml import clean_text
from poezio.ui.types import Message, BaseMessage, LoggableTrait from poezio.ui.types import Message, BaseMessage, LoggableTrait
from slixmpp import JID from slixmpp import JID
from slixmpp.types import TypedDict, Literal from poezio.types import TypedDict, Literal
import logging import logging

8
poezio/types.py Normal file
View file

@ -0,0 +1,8 @@
"""Poezio type stuff"""
try:
from typing import TypedDict, Literal
except ImportError:
from typing_extensions import TypedDict, Literal
__all__ = ['TypedDict', 'Literal']