Skip to content

Commit a1e581a

Browse files
committed
change mypy codes to ty codes
1 parent fef2ff7 commit a1e581a

File tree

2 files changed

+19
-19
lines changed

2 files changed

+19
-19
lines changed

sqlmodel/main.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ def __dataclass_transform__(
100100
return lambda a: a
101101

102102

103-
class FieldInfo(PydanticFieldInfo): # type: ignore[misc]
103+
class FieldInfo(PydanticFieldInfo): # ty: ignore[subclass-of-final-class]
104104
# mypy - ignore that PydanticFieldInfo is @final
105105
def __init__(self, default: Any = Undefined, **kwargs: Any) -> None:
106106
primary_key = kwargs.pop("primary_key", False)
@@ -608,10 +608,10 @@ def get_config(name: str) -> Any:
608608
# This could be done by reading new_cls.model_config['table'] in FastAPI, but
609609
# that's very specific about SQLModel, so let's have another config that
610610
# other future tools based on Pydantic can use.
611-
new_cls.model_config["read_from_attributes"] = True # type: ignore[typeddict-unknown-key]
611+
new_cls.model_config["read_from_attributes"] = True # ty: ignore[invalid-key]
612612
# For compatibility with older versions
613613
# TODO: remove this in the future
614-
new_cls.model_config["read_with_orm_mode"] = True # type: ignore[typeddict-unknown-key]
614+
new_cls.model_config["read_with_orm_mode"] = True # ty: ignore[invalid-key]
615615

616616
config_registry = get_config("registry")
617617
if config_registry is not Undefined:
@@ -867,7 +867,7 @@ def __tablename__(cls) -> str:
867867
return cls.__name__.lower()
868868

869869
@classmethod
870-
def model_validate( # type: ignore[override]
870+
def model_validate( # ty: ignore[invalid-method-override]
871871
cls: type[_TSQLModel],
872872
obj: Any,
873873
*,

sqlmodel/sql/expression.py

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -48,30 +48,30 @@
4848

4949

5050
def all_(expr: _ColumnExpressionArgument[_T] | _T) -> CollectionAggregate[bool]:
51-
return sqlalchemy.all_(expr) # type: ignore[arg-type]
51+
return sqlalchemy.all_(expr) # ty: ignore[invalid-argument-type]
5252

5353

5454
def and_(
5555
initial_clause: Literal[True] | _ColumnExpressionArgument[bool] | bool,
5656
*clauses: _ColumnExpressionArgument[bool] | bool,
5757
) -> ColumnElement[bool]:
58-
return sqlalchemy.and_(initial_clause, *clauses) # type: ignore[arg-type]
58+
return sqlalchemy.and_(initial_clause, *clauses) # ty: ignore[invalid-argument-type]
5959

6060

6161
def any_(expr: _ColumnExpressionArgument[_T] | _T) -> CollectionAggregate[bool]:
62-
return sqlalchemy.any_(expr) # type: ignore[arg-type]
62+
return sqlalchemy.any_(expr) # ty: ignore[invalid-argument-type]
6363

6464

6565
def asc(
6666
column: _ColumnExpressionOrStrLabelArgument[_T] | _T,
6767
) -> UnaryExpression[_T]:
68-
return sqlalchemy.asc(column) # type: ignore[arg-type]
68+
return sqlalchemy.asc(column) # ty: ignore[invalid-argument-type]
6969

7070

7171
def collate(
7272
expression: _ColumnExpressionArgument[str] | str, collation: str
7373
) -> BinaryExpression[str]:
74-
return sqlalchemy.collate(expression, collation) # type: ignore[arg-type]
74+
return sqlalchemy.collate(expression, collation) # ty: ignore[invalid-argument-type]
7575

7676

7777
def between(
@@ -84,15 +84,15 @@ def between(
8484

8585

8686
def not_(clause: _ColumnExpressionArgument[_T] | _T) -> ColumnElement[_T]:
87-
return sqlalchemy.not_(clause) # type: ignore[arg-type]
87+
return sqlalchemy.not_(clause) # ty: ignore[no-matching-overload]
8888

8989

9090
def case(
9191
*whens: tuple[_ColumnExpressionArgument[bool] | bool, Any] | Mapping[Any, Any],
9292
value: Any | None = None,
9393
else_: Any | None = None,
9494
) -> Case[Any]:
95-
return sqlalchemy.case(*whens, value=value, else_=else_) # type: ignore[arg-type]
95+
return sqlalchemy.case(*whens, value=value, else_=else_) # ty: ignore[invalid-argument-type]
9696

9797

9898
def cast(
@@ -112,15 +112,15 @@ def try_cast(
112112
def desc(
113113
column: _ColumnExpressionOrStrLabelArgument[_T] | _T,
114114
) -> UnaryExpression[_T]:
115-
return sqlalchemy.desc(column) # type: ignore[arg-type]
115+
return sqlalchemy.desc(column) # ty: ignore[invalid-argument-type]
116116

117117

118118
def distinct(expr: _ColumnExpressionArgument[_T] | _T) -> UnaryExpression[_T]:
119-
return sqlalchemy.distinct(expr) # type: ignore[arg-type]
119+
return sqlalchemy.distinct(expr) # ty: ignore[invalid-argument-type]
120120

121121

122122
def bitwise_not(expr: _ColumnExpressionArgument[_T] | _T) -> UnaryExpression[_T]:
123-
return sqlalchemy.bitwise_not(expr) # type: ignore[arg-type]
123+
return sqlalchemy.bitwise_not(expr) # ty: ignore[invalid-argument-type]
124124

125125

126126
def extract(field: str, expr: _ColumnExpressionArgument[Any] | Any) -> Extract:
@@ -130,32 +130,32 @@ def extract(field: str, expr: _ColumnExpressionArgument[Any] | Any) -> Extract:
130130
def funcfilter(
131131
func: FunctionElement[_T], *criterion: _ColumnExpressionArgument[bool] | bool
132132
) -> FunctionFilter[_T]:
133-
return sqlalchemy.funcfilter(func, *criterion) # type: ignore[arg-type]
133+
return sqlalchemy.funcfilter(func, *criterion) # ty: ignore[invalid-argument-type]
134134

135135

136136
def label(
137137
name: str,
138138
element: _ColumnExpressionArgument[_T] | _T,
139139
type_: Optional["_TypeEngineArgument[_T]"] = None,
140140
) -> Label[_T]:
141-
return sqlalchemy.label(name, element, type_=type_) # type: ignore[arg-type]
141+
return sqlalchemy.label(name, element, type_=type_) # ty: ignore[invalid-argument-type]
142142

143143

144144
def nulls_first(
145145
column: _ColumnExpressionArgument[_T] | _T,
146146
) -> UnaryExpression[_T]:
147-
return sqlalchemy.nulls_first(column) # type: ignore[arg-type]
147+
return sqlalchemy.nulls_first(column) # ty: ignore[invalid-argument-type]
148148

149149

150150
def nulls_last(column: _ColumnExpressionArgument[_T] | _T) -> UnaryExpression[_T]:
151-
return sqlalchemy.nulls_last(column) # type: ignore[arg-type]
151+
return sqlalchemy.nulls_last(column) # ty: ignore[invalid-argument-type]
152152

153153

154154
def or_(
155155
initial_clause: Literal[False] | _ColumnExpressionArgument[bool] | bool,
156156
*clauses: _ColumnExpressionArgument[bool] | bool,
157157
) -> ColumnElement[bool]:
158-
return sqlalchemy.or_(initial_clause, *clauses) # type: ignore[arg-type]
158+
return sqlalchemy.or_(initial_clause, *clauses) # ty: ignore[invalid-argument-type]
159159

160160

161161
def over(

0 commit comments

Comments
 (0)