diff --git a/babi/_types.py b/babi/_types.py new file mode 100644 index 0000000..b3f97e0 --- /dev/null +++ b/babi/_types.py @@ -0,0 +1,6 @@ +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from typing import Protocol # python3.8+ +else: + Protocol = object diff --git a/babi/list_spy.py b/babi/list_spy.py index aaf4215..f3dc86b 100644 --- a/babi/list_spy.py +++ b/babi/list_spy.py @@ -2,12 +2,8 @@ import functools from typing import Callable from typing import Iterator from typing import List -from typing import TYPE_CHECKING -if TYPE_CHECKING: - from typing import Protocol # python3.8+ -else: - Protocol = object +from babi._types import Protocol class MutableSequenceNoSlice(Protocol): diff --git a/tests/features/conftest.py b/tests/features/conftest.py index 93e7335..5250cfb 100644 --- a/tests/features/conftest.py +++ b/tests/features/conftest.py @@ -5,21 +5,16 @@ import shlex import sys from typing import List from typing import NamedTuple -from typing import TYPE_CHECKING from typing import Union from unittest import mock import pytest +from babi._types import Protocol from babi.main import main from babi.screen import VERSION_STR from testing.runner import PrintsErrorRunner -if TYPE_CHECKING: - from typing import Protocol -else: - Protocol = object - @pytest.fixture(autouse=True) def xdg_data_home(tmpdir):