diff --git a/hiku/cache.py b/hiku/cache.py index 02e0ff4..2deb846 100644 --- a/hiku/cache.py +++ b/hiku/cache.py @@ -17,11 +17,11 @@ Iterator, Optional, Callable, + Protocol, ) from prometheus_client import Counter -from hiku.compat import Protocol from hiku.result import Index from hiku.graph import ( Many, diff --git a/hiku/compat.py b/hiku/compat.py index 7793073..4baa825 100644 --- a/hiku/compat.py +++ b/hiku/compat.py @@ -2,8 +2,6 @@ import ast as _ast from typing import Any -# TODO: maybe we can remove this version check -PY38: bool = sys.version_info >= (3, 8) PY310: bool = sys.version_info >= (3, 10) @@ -22,18 +20,10 @@ def __getattr__(self, name: str) -> Any: else: from typing_extensions import Concatenate, ParamSpec, TypeAlias -# TODO: maybe we can remove this custom class ? -if sys.version_info >= (3, 8): - from typing import Protocol -else: - from typing_extensions import Protocol - __all__ = [ - "PY38", "PY310", "ast", - "Protocol", "Concatenate", "ParamSpec", "TypeAlias", diff --git a/hiku/executors/queue.py b/hiku/executors/queue.py index 4f48a0f..67c7964 100644 --- a/hiku/executors/queue.py +++ b/hiku/executors/queue.py @@ -10,9 +10,9 @@ Iterable, Set, Union, + Protocol, ) -from hiku.compat import Protocol from hiku.executors.base import BaseExecutor from hiku.result import Proxy diff --git a/hiku/validate/graph.py b/hiku/validate/graph.py index 116b16c..3daa51b 100644 --- a/hiku/validate/graph.py +++ b/hiku/validate/graph.py @@ -1,4 +1,5 @@ import typing as t +from typing import Protocol from itertools import chain from contextlib import contextmanager @@ -20,7 +21,6 @@ ) from ..graph import AbstractNode, AbstractField, AbstractLink, AbstractOption -from ..compat import Protocol from .errors import Errors from ..scalar import Scalar from ..types import GenericMeta, OptionalMeta diff --git a/tests/test_compiler.py b/tests/test_compiler.py index 523a3ad..98719bd 100644 --- a/tests/test_compiler.py +++ b/tests/test_compiler.py @@ -4,11 +4,9 @@ from collections import OrderedDict import astor -import pytest from hiku.types import Optional, String, Record, Any, TypeRef, Sequence from hiku.graph import Graph, Field, Node, Link, Root -from hiku.compat import PY38 from hiku.expr.core import define, S, if_, each, to_expr, if_some from hiku.expr.checker import check, fn_types from hiku.expr.compiler import ExpressionCompiler @@ -169,7 +167,6 @@ def test_generic_none(): check_compiles(None, "None") -@pytest.mark.skipif(not PY38, reason="Python < 3.8") def test_generic_bool(): check_compiles(True, "(True)")