Skip to content

Commit f462b3e

Browse files
author
KunxiSun
committed
fix: type lint check
1 parent 07bf10c commit f462b3e

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

sqlmodel/sql/sqltypes.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
1-
from typing import Any, cast, Optional
1+
from typing import Any, cast, Optional, TypeVar
22
from enum import IntEnum as _IntEnum
33

44
from sqlalchemy import types
55
from sqlalchemy.engine.interfaces import Dialect
66

77

8+
_TIntEnum = TypeVar('_TIntEnum', bound="_IntEnum")
9+
10+
811
class AutoString(types.TypeDecorator): # type: ignore
912
impl = types.String
1013
cache_ok = True
@@ -43,7 +46,7 @@ class IntEnum(types.TypeDecorator): # type: ignore
4346

4447
impl = types.Integer
4548

46-
def __init__(self, enum_type: _IntEnum, *args, **kwargs):
49+
def __init__(self, enum_type: _TIntEnum, *args, **kwargs):
4750
super().__init__(*args, **kwargs)
4851

4952
# validate the input enum type
@@ -54,15 +57,15 @@ def __init__(self, enum_type: _IntEnum, *args, **kwargs):
5457

5558
self.enum_type = enum_type
5659

57-
def process_result_value(self, value: Optional[int], dialect) -> Optional[_IntEnum]:
60+
def process_result_value(self, value: Optional[int], dialect: Dialect) -> Optional[_TIntEnum]:
5861

5962
if value is None:
6063
return None
6164

6265
result = self.enum_type(value)
6366
return result
6467

65-
def process_bind_param(self, value: Optional[_IntEnum], dialect) -> Optional[int]:
68+
def process_bind_param(self, value: Optional[_TIntEnum], dialect: Dialect) -> Optional[int]:
6669

6770
if value is None:
6871
return None

0 commit comments

Comments
 (0)