Skip to content

Commit 1bd5dee

Browse files
author
KunxiSun
committed
fix: sqltypes lint check
1 parent acb12ca commit 1bd5dee

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

sqlmodel/sql/sqltypes.py

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
from enum import IntEnum as _IntEnum
2-
from typing import Any, Optional, TypeVar, cast
2+
from typing import Any, Optional, TypeVar, Type, cast, Any
33

44
from sqlalchemy import types
55
from sqlalchemy.engine.interfaces import Dialect
@@ -46,7 +46,7 @@ class IntEnum(types.TypeDecorator): # type: ignore
4646

4747
impl = types.Integer
4848

49-
def __init__(self, enum_type: _TIntEnum, *args, **kwargs):
49+
def __init__(self, enum_type: Type[_TIntEnum], *args: Any, **kwargs: Any):
5050
super().__init__(*args, **kwargs)
5151

5252
# validate the input enum type
@@ -55,18 +55,24 @@ def __init__(self, enum_type: _TIntEnum, *args, **kwargs):
5555

5656
self.enum_type = enum_type
5757

58-
def process_result_value(
59-
self, value: Optional[int], dialect: Dialect
58+
def process_result_value( # type: ignore[override]
59+
self,
60+
value: Optional[int],
61+
dialect: Dialect,
6062
) -> Optional[_TIntEnum]:
63+
6164
if value is None:
6265
return None
6366

6467
result = self.enum_type(value)
6568
return result
6669

6770
def process_bind_param(
68-
self, value: Optional[_TIntEnum], dialect: Dialect
71+
self,
72+
value: Optional[_TIntEnum],
73+
dialect: Dialect,
6974
) -> Optional[int]:
75+
7076
if value is None:
7177
return None
7278

0 commit comments

Comments
 (0)