From 26d18dcca1b6fc316d650797144fe1cd18a190f7 Mon Sep 17 00:00:00 2001 From: Mathias Laurin Date: Sat, 11 Nov 2023 18:33:02 +0100 Subject: [PATCH] lint: Drop special-case imports for Python < 3.8 --- src/mbedtls/_tls.pyi | 8 +------- src/mbedtls/mpi.pyi | 8 +------- src/mbedtls/pk.pyi | 7 ++----- src/mbedtls/version.pyi | 8 +------- src/mbedtls/x509.pyi | 8 +------- 5 files changed, 6 insertions(+), 33 deletions(-) diff --git a/src/mbedtls/_tls.pyi b/src/mbedtls/_tls.pyi index 943f473b..cc4a967c 100644 --- a/src/mbedtls/_tls.pyi +++ b/src/mbedtls/_tls.pyi @@ -5,9 +5,8 @@ from __future__ import annotations import enum import os -import sys from collections import abc -from typing import Optional, Sequence, Tuple, Union, overload +from typing import Literal, Optional, Sequence, Tuple, Union, overload from mbedtls._tlsi import ( Certificate, @@ -17,11 +16,6 @@ from mbedtls._tlsi import ( TLSVersion, ) -if sys.version_info < (3, 8): - from typing_extensions import Literal -else: - from typing import Literal - _VERSION = Tuple[int, int] def ciphers_available() -> Sequence[str]: ... diff --git a/src/mbedtls/mpi.pyi b/src/mbedtls/mpi.pyi index fd1d9918..b24b46b3 100644 --- a/src/mbedtls/mpi.pyi +++ b/src/mbedtls/mpi.pyi @@ -4,13 +4,7 @@ from __future__ import annotations import numbers -import sys -from typing import Any, NoReturn, Optional, Tuple, Union, overload - -if sys.version_info < (3, 8): - from typing_extensions import Literal -else: - from typing import Literal +from typing import Any, Literal, NoReturn, Optional, Tuple, Union, overload _Integral = Union[numbers.Integral, int] diff --git a/src/mbedtls/pk.pyi b/src/mbedtls/pk.pyi index 9e438084..e515fa71 100644 --- a/src/mbedtls/pk.pyi +++ b/src/mbedtls/pk.pyi @@ -9,6 +9,8 @@ import os import sys from typing import ( Callable, + Final, + Literal, NamedTuple, NoReturn, Optional, @@ -19,11 +21,6 @@ from typing import ( overload, ) -if sys.version_info < (3, 8): - from typing_extensions import Final, Literal -else: - from typing import Final, Literal - if sys.version_info < (3, 9): _Path = Union[os.PathLike, str] # type: ignore [type-arg] else: diff --git a/src/mbedtls/version.pyi b/src/mbedtls/version.pyi index ed24c4c3..1a9a5f74 100644 --- a/src/mbedtls/version.pyi +++ b/src/mbedtls/version.pyi @@ -3,13 +3,7 @@ from __future__ import annotations -import sys -from typing import NamedTuple - -if sys.version_info < (3, 8): - from typing_extensions import Final -else: - from typing import Final +from typing import Final, NamedTuple class mbedtls_version(NamedTuple): major: int diff --git a/src/mbedtls/x509.pyi b/src/mbedtls/x509.pyi index 713e789e..322d1691 100644 --- a/src/mbedtls/x509.pyi +++ b/src/mbedtls/x509.pyi @@ -7,17 +7,11 @@ import abc import datetime as dt import enum import os -import sys -from typing import NamedTuple, Sequence, Tuple, Type, TypeVar, Union +from typing import Literal, NamedTuple, Sequence, Tuple, Type, TypeVar, Union from mbedtls.hashlib import Hash as _Hash from mbedtls.pk import ECC, RSA -if sys.version_info < (3, 8): - from typing_extensions import Literal -else: - from typing import Literal - _Path = Union[str, os.PathLike[str]] _DER = bytes _PEM = str