|
2 | 2 |
|
3 | 3 | import copy |
4 | 4 | import decimal |
| 5 | +from enum import Enum |
5 | 6 | import typing as t |
6 | 7 | import uuid |
7 | 8 | from datetime import date, datetime, time, timedelta |
@@ -165,7 +166,7 @@ class Band(Table): |
165 | 166 | def __init__( |
166 | 167 | self, |
167 | 168 | length: int = 255, |
168 | | - default: t.Union[str, t.Callable[[], str], None] = "", |
| 169 | + default: t.Union[str, Enum, t.Callable[[], str], None] = "", |
169 | 170 | **kwargs, |
170 | 171 | ) -> None: |
171 | 172 | self._validate_default(default, (str, None)) |
@@ -251,7 +252,9 @@ class Band(Table): |
251 | 252 | concat_delegate: ConcatDelegate = ConcatDelegate() |
252 | 253 |
|
253 | 254 | def __init__( |
254 | | - self, default: t.Union[str, None, t.Callable[[], str]] = "", **kwargs |
| 255 | + self, |
| 256 | + default: t.Union[str, Enum, None, t.Callable[[], str]] = "", |
| 257 | + **kwargs, |
255 | 258 | ) -> None: |
256 | 259 | self._validate_default(default, (str, None)) |
257 | 260 | self.default = default |
@@ -333,7 +336,9 @@ class Band(Table): |
333 | 336 | math_delegate = MathDelegate() |
334 | 337 |
|
335 | 338 | def __init__( |
336 | | - self, default: t.Union[int, t.Callable[[], int], None] = 0, **kwargs |
| 339 | + self, |
| 340 | + default: t.Union[int, Enum, t.Callable[[], int], None] = 0, |
| 341 | + **kwargs, |
337 | 342 | ) -> None: |
338 | 343 | self._validate_default(default, (int, None)) |
339 | 344 | self.default = default |
@@ -771,7 +776,7 @@ class Band(Table): |
771 | 776 |
|
772 | 777 | def __init__( |
773 | 778 | self, |
774 | | - default: t.Union[bool, t.Callable[[], bool], None] = False, |
| 779 | + default: t.Union[bool, Enum, t.Callable[[], bool], None] = False, |
775 | 780 | **kwargs, |
776 | 781 | ) -> None: |
777 | 782 | self._validate_default(default, (bool, None)) |
@@ -841,7 +846,7 @@ def __init__( |
841 | 846 | self, |
842 | 847 | digits: t.Optional[t.Tuple[int, int]] = None, |
843 | 848 | default: t.Union[ |
844 | | - decimal.Decimal, t.Callable[[], decimal.Decimal], None |
| 849 | + decimal.Decimal, Enum, t.Callable[[], decimal.Decimal], None |
845 | 850 | ] = decimal.Decimal(0.0), |
846 | 851 | **kwargs, |
847 | 852 | ) -> None: |
@@ -897,7 +902,7 @@ class Concert(Table): |
897 | 902 |
|
898 | 903 | def __init__( |
899 | 904 | self, |
900 | | - default: t.Union[float, t.Callable[[], float], None] = 0.0, |
| 905 | + default: t.Union[float, Enum, t.Callable[[], float], None] = 0.0, |
901 | 906 | **kwargs, |
902 | 907 | ) -> None: |
903 | 908 | self._validate_default(default, (float, None)) |
@@ -1087,7 +1092,7 @@ class Band(Table): |
1087 | 1092 | def __init__( |
1088 | 1093 | self, |
1089 | 1094 | references: t.Union[t.Type[Table], LazyTableReference, str], |
1090 | | - default: t.Union[int, None] = None, |
| 1095 | + default: t.Union[int, Enum, None] = None, |
1091 | 1096 | null: bool = True, |
1092 | 1097 | on_delete: OnDelete = OnDelete.cascade, |
1093 | 1098 | on_update: OnUpdate = OnUpdate.cascade, |
@@ -1324,6 +1329,7 @@ def __init__( |
1324 | 1329 | default: t.Union[ |
1325 | 1330 | bytes, |
1326 | 1331 | bytearray, |
| 1332 | + Enum, |
1327 | 1333 | t.Callable[[], bytes], |
1328 | 1334 | t.Callable[[], bytearray], |
1329 | 1335 | None, |
@@ -1376,7 +1382,7 @@ class Ticket(Table): |
1376 | 1382 | def __init__( |
1377 | 1383 | self, |
1378 | 1384 | base_column: Column, |
1379 | | - default: t.Union[t.List, t.Callable[[], t.List], None] = list, |
| 1385 | + default: t.Union[t.List, Enum, t.Callable[[], t.List], None] = list, |
1380 | 1386 | **kwargs, |
1381 | 1387 | ) -> None: |
1382 | 1388 | if isinstance(base_column, ForeignKey): |
|
0 commit comments