Skip to content

Commit e86c21f

Browse files
committed
type alias generic compliant values
1 parent ac3c974 commit e86c21f

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

pointblank/_typing.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
from __future__ import annotations
22

3+
import datetime
34
import sys
5+
from collections.abc import Container
46
from typing import List, Tuple, Union
57

68
# Check Python version for TypeAlias support
@@ -15,6 +17,12 @@
1517
SegmentTuple: TypeAlias = Tuple[str, SegmentValue]
1618
SegmentItem: TypeAlias = Union[str, SegmentTuple]
1719
SegmentSpec: TypeAlias = Union[str, SegmentTuple, List[SegmentItem]]
20+
21+
_CompliantValue: TypeAlias = Union[str, int, float, datetime.datetime, datetime.date]
22+
"""A compliant value that pointblank can use in a validation step"""
23+
_CompliantValues: TypeAlias = Container[_CompliantValue]
24+
"""A collection of compliant values that pointblank can use in a validation step"""
25+
1826
else:
1927
# Python 3.8 and 3.9 compatible type aliases
2028
AbsoluteBounds = Tuple[int, int]
@@ -24,6 +32,10 @@
2432
SegmentTuple = Tuple[str, SegmentValue]
2533
SegmentItem = Union[str, SegmentTuple]
2634
SegmentSpec = Union[str, SegmentTuple, List[SegmentItem]]
35+
_CompliantValue = Union[str, int, float, datetime.datetime, datetime.date]
36+
"""A compliant value that pointblank can use in a validation step"""
37+
_CompliantValues = Container[_CompliantValue]
38+
"""A collection of compliant values that pointblank can use in a validation step"""
2739

2840
# Add docstrings for better IDE support
2941
AbsoluteBounds.__doc__ = "Absolute bounds (i.e., plus or minus)"

0 commit comments

Comments
 (0)