Skip to content

Commit 3203f83

Browse files
committed
remove unnecessary type ignore statements
1 parent a52380b commit 3203f83

File tree

4 files changed

+52
-52
lines changed

4 files changed

+52
-52
lines changed

sqlmodel/main.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252
from sqlalchemy.sql.sqltypes import LargeBinary, Time, Uuid
5353
from typing_extensions import deprecated
5454

55-
from ._compat import ( # type: ignore[attr-defined]
55+
from ._compat import (
5656
PYDANTIC_MINOR_VERSION,
5757
BaseConfig,
5858
ModelMetaclass,
@@ -177,7 +177,7 @@ def __init__(
177177
cascade_delete: bool | None = False,
178178
passive_deletes: bool | Literal["all"] | None = False,
179179
link_model: Any | None = None,
180-
sa_relationship: RelationshipProperty | None = None, # type: ignore
180+
sa_relationship: RelationshipProperty | None = None,
181181
sa_relationship_args: Sequence[Any] | None = None,
182182
sa_relationship_kwargs: Mapping[str, Any] | None = None,
183183
) -> None:
@@ -398,7 +398,7 @@ def Field(
398398
nullable: bool | UndefinedType = Undefined,
399399
index: bool | UndefinedType = Undefined,
400400
sa_type: type[Any] | UndefinedType = Undefined,
401-
sa_column: Column | UndefinedType = Undefined, # type: ignore
401+
sa_column: Column | UndefinedType = Undefined,
402402
sa_column_args: Sequence[Any] | UndefinedType = Undefined,
403403
sa_column_kwargs: Mapping[str, Any] | UndefinedType = Undefined,
404404
schema_extra: dict[str, Any] | None = None,
@@ -649,7 +649,7 @@ def __init__(
649649
# Plain forward references, for models not yet defined, are not
650650
# handled well by SQLAlchemy without Mapped, so, wrap the
651651
# annotations in Mapped here
652-
cls.__annotations__[rel_name] = Mapped[ann] # type: ignore[valid-type]
652+
cls.__annotations__[rel_name] = Mapped[ann]
653653
relationship_to = get_relationship_to(
654654
name=rel_name, rel_info=rel_info, annotation=ann
655655
)
@@ -738,7 +738,7 @@ def get_sqlalchemy_type(field: Any) -> Any:
738738
raise ValueError(f"{type_} has no matching SQLAlchemy type")
739739

740740

741-
def get_column_from_field(field: Any) -> Column: # type: ignore
741+
def get_column_from_field(field: Any) -> Column:
742742
field_info = field
743743
sa_column = _get_sqlmodel_field_value(field_info, "sa_column", Undefined)
744744
if isinstance(sa_column, Column):
@@ -797,7 +797,7 @@ def get_column_from_field(field: Any) -> Column: # type: ignore
797797
return Column(sa_type, *args, **kwargs)
798798

799799

800-
class_registry = weakref.WeakValueDictionary() # type: ignore
800+
class_registry = weakref.WeakValueDictionary()
801801

802802
default_registry = registry()
803803

@@ -850,7 +850,7 @@ def __setattr__(self, name: str, value: Any) -> None:
850850
return
851851
else:
852852
# Set in SQLAlchemy, before Pydantic to trigger events and updates
853-
if is_table_model_class(self.__class__) and is_instrumented(self, name): # type: ignore[no-untyped-call]
853+
if is_table_model_class(self.__class__) and is_instrumented(self, name):
854854
set_attribute(self, name, value)
855855
# Set in Pydantic model to trigger possible validation changes, only for
856856
# non relationship values

sqlmodel/sql/_expression_select_cls.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,13 @@ def where(self, *whereclause: _ColumnExpressionArgument[bool] | bool) -> Self:
2020
"""Return a new `Select` construct with the given expression added to
2121
its `WHERE` clause, joined to the existing clause via `AND`, if any.
2222
"""
23-
return super().where(*whereclause) # type: ignore[arg-type]
23+
return super().where(*whereclause)
2424

2525
def having(self, *having: _ColumnExpressionArgument[bool] | bool) -> Self:
2626
"""Return a new `Select` construct with the given expression added to
2727
its `HAVING` clause, joined to the existing clause via `AND`, if any.
2828
"""
29-
return super().having(*having) # type: ignore[arg-type]
29+
return super().having(*having)
3030

3131

3232
class Select(SelectBase[_T]):

sqlmodel/sql/_expression_select_gen.py

Lines changed: 42 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,9 @@
2929

3030
_TScalar_0 = TypeVar(
3131
"_TScalar_0",
32-
Column, # type: ignore
33-
Sequence, # type: ignore
34-
Mapping, # type: ignore
32+
Column,
33+
Sequence,
34+
Mapping,
3535
UUID,
3636
datetime,
3737
float,
@@ -47,9 +47,9 @@
4747

4848
_TScalar_1 = TypeVar(
4949
"_TScalar_1",
50-
Column, # type: ignore
51-
Sequence, # type: ignore
52-
Mapping, # type: ignore
50+
Column,
51+
Sequence,
52+
Mapping,
5353
UUID,
5454
datetime,
5555
float,
@@ -65,9 +65,9 @@
6565

6666
_TScalar_2 = TypeVar(
6767
"_TScalar_2",
68-
Column, # type: ignore
69-
Sequence, # type: ignore
70-
Mapping, # type: ignore
68+
Column,
69+
Sequence,
70+
Mapping,
7171
UUID,
7272
datetime,
7373
float,
@@ -83,9 +83,9 @@
8383

8484
_TScalar_3 = TypeVar(
8585
"_TScalar_3",
86-
Column, # type: ignore
87-
Sequence, # type: ignore
88-
Mapping, # type: ignore
86+
Column,
87+
Sequence,
88+
Mapping,
8989
UUID,
9090
datetime,
9191
float,
@@ -107,107 +107,107 @@ def select(__ent0: _TCCA[_T0]) -> SelectOfScalar[_T0]: ...
107107

108108

109109
@overload
110-
def select(__ent0: _TScalar_0) -> SelectOfScalar[_TScalar_0]: # type: ignore
110+
def select(__ent0: _TScalar_0) -> SelectOfScalar[_TScalar_0]:
111111
...
112112

113113

114114
# Generated overloads start
115115

116116

117117
@overload
118-
def select( # type: ignore
118+
def select(
119119
__ent0: _TCCA[_T0],
120120
__ent1: _TCCA[_T1],
121121
) -> Select[tuple[_T0, _T1]]: ...
122122

123123

124124
@overload
125-
def select( # type: ignore
125+
def select(
126126
__ent0: _TCCA[_T0],
127127
entity_1: _TScalar_1,
128128
) -> Select[tuple[_T0, _TScalar_1]]: ...
129129

130130

131131
@overload
132-
def select( # type: ignore
132+
def select(
133133
entity_0: _TScalar_0,
134134
__ent1: _TCCA[_T1],
135135
) -> Select[tuple[_TScalar_0, _T1]]: ...
136136

137137

138138
@overload
139-
def select( # type: ignore
139+
def select(
140140
entity_0: _TScalar_0,
141141
entity_1: _TScalar_1,
142142
) -> Select[tuple[_TScalar_0, _TScalar_1]]: ...
143143

144144

145145
@overload
146-
def select( # type: ignore
146+
def select(
147147
__ent0: _TCCA[_T0],
148148
__ent1: _TCCA[_T1],
149149
__ent2: _TCCA[_T2],
150150
) -> Select[tuple[_T0, _T1, _T2]]: ...
151151

152152

153153
@overload
154-
def select( # type: ignore
154+
def select(
155155
__ent0: _TCCA[_T0],
156156
__ent1: _TCCA[_T1],
157157
entity_2: _TScalar_2,
158158
) -> Select[tuple[_T0, _T1, _TScalar_2]]: ...
159159

160160

161161
@overload
162-
def select( # type: ignore
162+
def select(
163163
__ent0: _TCCA[_T0],
164164
entity_1: _TScalar_1,
165165
__ent2: _TCCA[_T2],
166166
) -> Select[tuple[_T0, _TScalar_1, _T2]]: ...
167167

168168

169169
@overload
170-
def select( # type: ignore
170+
def select(
171171
__ent0: _TCCA[_T0],
172172
entity_1: _TScalar_1,
173173
entity_2: _TScalar_2,
174174
) -> Select[tuple[_T0, _TScalar_1, _TScalar_2]]: ...
175175

176176

177177
@overload
178-
def select( # type: ignore
178+
def select(
179179
entity_0: _TScalar_0,
180180
__ent1: _TCCA[_T1],
181181
__ent2: _TCCA[_T2],
182182
) -> Select[tuple[_TScalar_0, _T1, _T2]]: ...
183183

184184

185185
@overload
186-
def select( # type: ignore
186+
def select(
187187
entity_0: _TScalar_0,
188188
__ent1: _TCCA[_T1],
189189
entity_2: _TScalar_2,
190190
) -> Select[tuple[_TScalar_0, _T1, _TScalar_2]]: ...
191191

192192

193193
@overload
194-
def select( # type: ignore
194+
def select(
195195
entity_0: _TScalar_0,
196196
entity_1: _TScalar_1,
197197
__ent2: _TCCA[_T2],
198198
) -> Select[tuple[_TScalar_0, _TScalar_1, _T2]]: ...
199199

200200

201201
@overload
202-
def select( # type: ignore
202+
def select(
203203
entity_0: _TScalar_0,
204204
entity_1: _TScalar_1,
205205
entity_2: _TScalar_2,
206206
) -> Select[tuple[_TScalar_0, _TScalar_1, _TScalar_2]]: ...
207207

208208

209209
@overload
210-
def select( # type: ignore
210+
def select(
211211
__ent0: _TCCA[_T0],
212212
__ent1: _TCCA[_T1],
213213
__ent2: _TCCA[_T2],
@@ -216,7 +216,7 @@ def select( # type: ignore
216216

217217

218218
@overload
219-
def select( # type: ignore
219+
def select(
220220
__ent0: _TCCA[_T0],
221221
__ent1: _TCCA[_T1],
222222
__ent2: _TCCA[_T2],
@@ -225,7 +225,7 @@ def select( # type: ignore
225225

226226

227227
@overload
228-
def select( # type: ignore
228+
def select(
229229
__ent0: _TCCA[_T0],
230230
__ent1: _TCCA[_T1],
231231
entity_2: _TScalar_2,
@@ -234,7 +234,7 @@ def select( # type: ignore
234234

235235

236236
@overload
237-
def select( # type: ignore
237+
def select(
238238
__ent0: _TCCA[_T0],
239239
__ent1: _TCCA[_T1],
240240
entity_2: _TScalar_2,
@@ -243,7 +243,7 @@ def select( # type: ignore
243243

244244

245245
@overload
246-
def select( # type: ignore
246+
def select(
247247
__ent0: _TCCA[_T0],
248248
entity_1: _TScalar_1,
249249
__ent2: _TCCA[_T2],
@@ -252,7 +252,7 @@ def select( # type: ignore
252252

253253

254254
@overload
255-
def select( # type: ignore
255+
def select(
256256
__ent0: _TCCA[_T0],
257257
entity_1: _TScalar_1,
258258
__ent2: _TCCA[_T2],
@@ -261,7 +261,7 @@ def select( # type: ignore
261261

262262

263263
@overload
264-
def select( # type: ignore
264+
def select(
265265
__ent0: _TCCA[_T0],
266266
entity_1: _TScalar_1,
267267
entity_2: _TScalar_2,
@@ -270,7 +270,7 @@ def select( # type: ignore
270270

271271

272272
@overload
273-
def select( # type: ignore
273+
def select(
274274
__ent0: _TCCA[_T0],
275275
entity_1: _TScalar_1,
276276
entity_2: _TScalar_2,
@@ -279,7 +279,7 @@ def select( # type: ignore
279279

280280

281281
@overload
282-
def select( # type: ignore
282+
def select(
283283
entity_0: _TScalar_0,
284284
__ent1: _TCCA[_T1],
285285
__ent2: _TCCA[_T2],
@@ -288,7 +288,7 @@ def select( # type: ignore
288288

289289

290290
@overload
291-
def select( # type: ignore
291+
def select(
292292
entity_0: _TScalar_0,
293293
__ent1: _TCCA[_T1],
294294
__ent2: _TCCA[_T2],
@@ -297,7 +297,7 @@ def select( # type: ignore
297297

298298

299299
@overload
300-
def select( # type: ignore
300+
def select(
301301
entity_0: _TScalar_0,
302302
__ent1: _TCCA[_T1],
303303
entity_2: _TScalar_2,
@@ -306,7 +306,7 @@ def select( # type: ignore
306306

307307

308308
@overload
309-
def select( # type: ignore
309+
def select(
310310
entity_0: _TScalar_0,
311311
__ent1: _TCCA[_T1],
312312
entity_2: _TScalar_2,
@@ -315,7 +315,7 @@ def select( # type: ignore
315315

316316

317317
@overload
318-
def select( # type: ignore
318+
def select(
319319
entity_0: _TScalar_0,
320320
entity_1: _TScalar_1,
321321
__ent2: _TCCA[_T2],
@@ -324,7 +324,7 @@ def select( # type: ignore
324324

325325

326326
@overload
327-
def select( # type: ignore
327+
def select(
328328
entity_0: _TScalar_0,
329329
entity_1: _TScalar_1,
330330
__ent2: _TCCA[_T2],
@@ -333,7 +333,7 @@ def select( # type: ignore
333333

334334

335335
@overload
336-
def select( # type: ignore
336+
def select(
337337
entity_0: _TScalar_0,
338338
entity_1: _TScalar_1,
339339
entity_2: _TScalar_2,
@@ -342,7 +342,7 @@ def select( # type: ignore
342342

343343

344344
@overload
345-
def select( # type: ignore
345+
def select(
346346
entity_0: _TScalar_0,
347347
entity_1: _TScalar_1,
348348
entity_2: _TScalar_2,
@@ -353,7 +353,7 @@ def select( # type: ignore
353353
# Generated overloads end
354354

355355

356-
def select(*entities: Any) -> Select | SelectOfScalar: # type: ignore
356+
def select(*entities: Any) -> Select | SelectOfScalar:
357357
if len(entities) == 1:
358358
return SelectOfScalar(*entities)
359359
return Select(*entities)

0 commit comments

Comments
 (0)