Skip to content

Commit 97063ec

Browse files
committed
use mypy ability to check sys.version_info to use exact types to support older python versions
1 parent 66ae24c commit 97063ec

1 file changed

Lines changed: 4 additions & 7 deletions

File tree

sqlbind_t/template.py

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import ast
22
import sys
33
from ast import Expression, FormattedValue
4-
from typing import TYPE_CHECKING, Iterator, List, Union
4+
from typing import Iterator, List, Union
55

66
from .compat import pyver
77

@@ -37,14 +37,11 @@ def __repr__(self) -> str:
3737
return f'Interpolation({self.value!r})'
3838

3939

40-
if TYPE_CHECKING:
40+
if sys.version_info >= (3, 14):
4141
from string.templatelib import Interpolation, Template
4242
else:
43-
if HAS_TSTRINGS: # pragma: no cover
44-
from string.templatelib import Interpolation, Template
45-
else:
46-
Template = NTemplate
47-
Interpolation = NInterpolation
43+
Template = NTemplate
44+
Interpolation = NInterpolation
4845

4946

5047
def parse_template(string: str, *, level: int = 1) -> Template:

0 commit comments

Comments
 (0)