Skip to content

Commit d823542

Browse files
committed
TypeAlias
1 parent b274d59 commit d823542

2 files changed

Lines changed: 12 additions & 8 deletions

File tree

sql_athame/dataclasses.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,18 @@
1313
get_type_hints,
1414
)
1515

16+
from typing_extensions import TypeAlias
17+
1618
from .base import Fragment, sql
1719

18-
Where = Union[Fragment, Iterable[Fragment]]
20+
Where: TypeAlias = Union[Fragment, Iterable[Fragment]]
1921
# KLUDGE to avoid a string argument being valid
20-
SequenceOfStrings = Union[list[str], tuple[str, ...]]
21-
FieldNames = SequenceOfStrings
22-
FieldNamesSet = Union[SequenceOfStrings, set[str]]
22+
SequenceOfStrings: TypeAlias = Union[list[str], tuple[str, ...]]
23+
FieldNames: TypeAlias = SequenceOfStrings
24+
FieldNamesSet: TypeAlias = Union[SequenceOfStrings, set[str]]
2325

24-
Connection = Any
25-
Pool = Any
26+
Connection: TypeAlias = Any
27+
Pool: TypeAlias = Any
2628

2729

2830
@dataclass

sql_athame/types.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import dataclasses
22
from typing import TYPE_CHECKING, Any, Union
33

4+
from typing_extensions import TypeAlias
5+
46

57
@dataclasses.dataclass(eq=False)
68
class Placeholder:
@@ -15,8 +17,8 @@ class Slot:
1517
name: str
1618

1719

18-
Part = Union[str, Placeholder, Slot, "Fragment"]
19-
FlatPart = Union[str, Placeholder, Slot]
20+
Part: TypeAlias = Union[str, Placeholder, Slot, "Fragment"]
21+
FlatPart: TypeAlias = Union[str, Placeholder, Slot]
2022

2123
if TYPE_CHECKING:
2224
from .base import Fragment

0 commit comments

Comments
 (0)