From 3a2d2ca241b34e7a194427a981c4be713823f4f9 Mon Sep 17 00:00:00 2001 From: David Rajaratnam Date: Tue, 13 Feb 2024 21:55:28 +1100 Subject: [PATCH] Formmatting and conditional imports based on python version --- clorm/orm/_typing.py | 2 +- requirements.txt | 2 +- tests/test_mypy_query.py | 6 +++++- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/clorm/orm/_typing.py b/clorm/orm/_typing.py index da8c815..d317904 100644 --- a/clorm/orm/_typing.py +++ b/clorm/orm/_typing.py @@ -1,5 +1,5 @@ -import sys import inspect +import sys from inspect import FrameInfo from typing import Any, Dict, ForwardRef, Optional, Tuple, Type, TypeVar, Union, _eval_type, cast diff --git a/requirements.txt b/requirements.txt index 836997d..5f1b583 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,3 @@ clingo>=5.5.1 -typing_extensions; python_version < '3.8' +typing_extensions; python_version < '3.11' dataclasses; python_version == '3.6' diff --git a/tests/test_mypy_query.py b/tests/test_mypy_query.py index ed6333c..05e3d92 100644 --- a/tests/test_mypy_query.py +++ b/tests/test_mypy_query.py @@ -1,6 +1,10 @@ +import sys from typing import Tuple -from typing_extensions import reveal_type +if sys.version_info < (3, 11): + from typing_extensions import reveal_type +else: + from typing import reveal_type from clorm import FactBase, Predicate from clorm.orm._queryimpl import GroupedQuery, UnGroupedQuery