|
1 | | -from typing import Any, cast, Optional, TypeVar |
2 | 1 | from enum import IntEnum as _IntEnum |
| 2 | +from typing import Any, Optional, TypeVar, cast |
3 | 3 |
|
4 | 4 | from sqlalchemy import types |
5 | 5 | from sqlalchemy.engine.interfaces import Dialect |
6 | 6 |
|
7 | | - |
8 | | -_TIntEnum = TypeVar('_TIntEnum', bound="_IntEnum") |
| 7 | +_TIntEnum = TypeVar("_TIntEnum", bound="_IntEnum") |
9 | 8 |
|
10 | 9 |
|
11 | 10 | class AutoString(types.TypeDecorator): # type: ignore |
@@ -56,16 +55,18 @@ def __init__(self, enum_type: _TIntEnum, *args, **kwargs): |
56 | 55 |
|
57 | 56 | self.enum_type = enum_type |
58 | 57 |
|
59 | | - def process_result_value(self, value: Optional[int], dialect: Dialect) -> Optional[_TIntEnum]: |
60 | | - |
| 58 | + def process_result_value( |
| 59 | + self, value: Optional[int], dialect: Dialect |
| 60 | + ) -> Optional[_TIntEnum]: |
61 | 61 | if value is None: |
62 | 62 | return None |
63 | 63 |
|
64 | 64 | result = self.enum_type(value) |
65 | 65 | return result |
66 | 66 |
|
67 | | - def process_bind_param(self, value: Optional[_TIntEnum], dialect: Dialect) -> Optional[int]: |
68 | | - |
| 67 | + def process_bind_param( |
| 68 | + self, value: Optional[_TIntEnum], dialect: Dialect |
| 69 | + ) -> Optional[int]: |
69 | 70 | if value is None: |
70 | 71 | return None |
71 | 72 |
|
|
0 commit comments