Skip to content

Commit

Permalink
lint: Drop special-case imports for Python < 3.8
Browse files Browse the repository at this point in the history
  • Loading branch information
Synss committed Nov 11, 2023
1 parent 91645cc commit 26d18dc
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 33 deletions.
8 changes: 1 addition & 7 deletions src/mbedtls/_tls.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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]: ...
Expand Down
8 changes: 1 addition & 7 deletions src/mbedtls/mpi.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -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]

Expand Down
7 changes: 2 additions & 5 deletions src/mbedtls/pk.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ import os
import sys
from typing import (
Callable,
Final,
Literal,
NamedTuple,
NoReturn,
Optional,
Expand All @@ -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:
Expand Down
8 changes: 1 addition & 7 deletions src/mbedtls/version.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 1 addition & 7 deletions src/mbedtls/x509.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 26d18dc

Please sign in to comment.