Skip to content

Commit e244ff8

Browse files
committed
dev
1 parent 5d572a1 commit e244ff8

File tree

4 files changed

+31
-28
lines changed

4 files changed

+31
-28
lines changed

sqlalchemy-stubs/orm/__init__.pyi

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ from typing import Optional
33

44
from .attributes import AttributeEvent as AttributeEvent
55
from .attributes import InstrumentedAttribute as InstrumentedAttribute
6+
from .attributes import Mapped as Mapped
67
from .attributes import QueryableAttribute as QueryableAttribute
78
from .context import QueryContext as QueryContext
89
from .decl_api import as_declarative as as_declarative

sqlalchemy-stubs/orm/attributes.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ class Mapped(QueryableAttribute, Generic[_T]):
9090
@overload
9191
def __get__(self, instance: None, owner: Any) -> Mapped[_T]: ...
9292
@overload
93-
def __get__(self, instance: object, owner: Any) -> Union[_T, None]: ...
93+
def __get__(self, instance: object, owner: Any) -> _T: ...
9494
def __set__(self, instance: Any, value: _T) -> None: ...
9595
def __delete__(self, instance: Any) -> None: ...
9696

sqlalchemy-stubs/sql/elements.pyi

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ from . import roles as roles
99
from . import traversals as traversals
1010
from . import type_api as type_api
1111
from .annotation import Annotated as Annotated
12-
from .annotation import SupportsWrappingAnnotations as SupportsWrappingAnnotations
12+
from .annotation import SupportsWrappingAnnotations
1313
from .base import Executable as Executable
1414
from .base import HasMemoized as HasMemoized
1515
from .base import Immutable as Immutable
@@ -27,6 +27,8 @@ from .. import exc as exc
2727
from .. import inspection as inspection
2828
from .. import util as util
2929

30+
_T = TypeVar("_T", bound=type_api.TypeEngine)
31+
3032
def collate(expression: Any, collation: Any): ...
3133
def between(
3234
expr: Any, lower_bound: Any, upper_bound: Any, symmetric: bool = ...
@@ -64,8 +66,6 @@ class ClauseElement(
6466
def __bool__(self) -> None: ...
6567
__nonzero__: Any = ...
6668

67-
_T = TypeVar("_T")
68-
6969
class ColumnElement(
7070
roles.ColumnArgumentOrKeyRole,
7171
roles.StatementOptionRole,
@@ -79,7 +79,7 @@ class ColumnElement(
7979
roles.DDLExpressionRole,
8080
operators.ColumnOperators,
8181
ClauseElement,
82-
Generic[_T]
82+
Generic[_T],
8383
):
8484
__visit_name__: str = ...
8585
primary_key: bool = ...
@@ -107,7 +107,7 @@ class WrapsColumnExpression:
107107
@property
108108
def anon_label(self): ...
109109

110-
class BindParameter(roles.InElementRole, ColumnElement):
110+
class BindParameter(roles.InElementRole, ColumnElement[_T]):
111111
__visit_name__: str = ...
112112
inherit_cache: bool = ...
113113
key: Any = ...
@@ -171,15 +171,15 @@ class TextClause(
171171
self, against: Optional[Any] = ...
172172
) -> Union[Grouping, TextClause]: ...
173173

174-
class Null(SingletonConstant, roles.ConstExprRole, ColumnElement):
174+
class Null(SingletonConstant, roles.ConstExprRole, ColumnElement[_T]):
175175
__visit_name__: str = ...
176176
def type(self): ...
177177

178-
class False_(SingletonConstant, roles.ConstExprRole, ColumnElement):
178+
class False_(SingletonConstant, roles.ConstExprRole, ColumnElement[_T]):
179179
__visit_name__: str = ...
180180
def type(self): ...
181181

182-
class True_(SingletonConstant, roles.ConstExprRole, ColumnElement):
182+
class True_(SingletonConstant, roles.ConstExprRole, ColumnElement[_T]):
183183
__visit_name__: str = ...
184184
def type(self): ...
185185

@@ -201,7 +201,7 @@ class ClauseList(
201201
def append(self, clause: Any) -> None: ...
202202
def self_group(self, against: Optional[Any] = ...) -> ClauseElement: ...
203203

204-
class BooleanClauseList(ClauseList, ColumnElement):
204+
class BooleanClauseList(ClauseList, ColumnElement[_T]):
205205
__visit_name__: str = ...
206206
inherit_cache: bool = ...
207207
def __init__(self, *arg: Any, **kw: Any) -> None: ...
@@ -214,13 +214,13 @@ class BooleanClauseList(ClauseList, ColumnElement):
214214
and_: Any
215215
or_: Any
216216

217-
class Tuple(ClauseList, ColumnElement):
217+
class Tuple(ClauseList, ColumnElement[_T]):
218218
__visit_name__: str = ...
219219
type: Any = ...
220220
def __init__(self, *clauses: Any, **kw: Any) -> None: ...
221221
def self_group(self, against: Optional[Any] = ...): ...
222222

223-
class Case(ColumnElement):
223+
class Case(ColumnElement[_T]):
224224
__visit_name__: str = ...
225225
value: Any = ...
226226
type: Any = ...
@@ -230,7 +230,7 @@ class Case(ColumnElement):
230230

231231
def literal_column(text: Any, type_: Optional[Any] = ...): ...
232232

233-
class Cast(WrapsColumnExpression, ColumnElement):
233+
class Cast(WrapsColumnExpression, ColumnElement[_T]):
234234
__visit_name__: str = ...
235235
type: Any = ...
236236
clause: Any = ...
@@ -239,7 +239,7 @@ class Cast(WrapsColumnExpression, ColumnElement):
239239
@property
240240
def wrapped_column_expression(self): ...
241241

242-
class TypeCoerce(WrapsColumnExpression, ColumnElement):
242+
class TypeCoerce(WrapsColumnExpression, ColumnElement[_T]):
243243
__visit_name__: str = ...
244244
type: Any = ...
245245
clause: Any = ...
@@ -249,24 +249,24 @@ class TypeCoerce(WrapsColumnExpression, ColumnElement):
249249
def wrapped_column_expression(self): ...
250250
def self_group(self, against: Optional[Any] = ...): ...
251251

252-
class Extract(ColumnElement):
252+
class Extract(ColumnElement[_T]):
253253
__visit_name__: str = ...
254254
type: Any = ...
255255
field: Any = ...
256256
expr: Any = ...
257257
def __init__(self, field: Any, expr: Any, **kwargs: Any) -> None: ...
258258

259-
class _label_reference(ColumnElement):
259+
class _label_reference(ColumnElement[_T]):
260260
__visit_name__: str = ...
261261
element: Any = ...
262262
def __init__(self, element: Any) -> None: ...
263263

264-
class _textual_label_reference(ColumnElement):
264+
class _textual_label_reference(ColumnElement[_T]):
265265
__visit_name__: str = ...
266266
element: Any = ...
267267
def __init__(self, element: Any) -> None: ...
268268

269-
class UnaryExpression(ColumnElement):
269+
class UnaryExpression(ColumnElement[_T]):
270270
__visit_name__: str = ...
271271
operator: Any = ...
272272
modifier: Any = ...
@@ -300,7 +300,7 @@ class AsBoolean(WrapsColumnExpression, UnaryExpression):
300300
def wrapped_column_expression(self): ...
301301
def self_group(self, against: Optional[Any] = ...) -> ClauseElement: ...
302302

303-
class BinaryExpression(ColumnElement):
303+
class BinaryExpression(ColumnElement[_T]):
304304
__visit_name__: str = ...
305305
left: Any = ...
306306
right: Any = ...
@@ -323,7 +323,7 @@ class BinaryExpression(ColumnElement):
323323
def is_comparison(self): ...
324324
def self_group(self, against: Optional[Any] = ...) -> ClauseElement: ...
325325

326-
class Slice(ColumnElement):
326+
class Slice(ColumnElement[_T]):
327327
__visit_name__: str = ...
328328
start: Any = ...
329329
stop: Any = ...
@@ -340,7 +340,7 @@ class GroupedElement(ClauseElement):
340340
__visit_name__: str = ...
341341
def self_group(self, against: Optional[Any] = ...) -> ClauseElement: ...
342342

343-
class Grouping(GroupedElement, ColumnElement):
343+
class Grouping(GroupedElement, ColumnElement[_T]):
344344
element: Any = ...
345345
type: Any = ...
346346
def __init__(self, element: Any) -> None: ...
@@ -349,7 +349,7 @@ class Grouping(GroupedElement, ColumnElement):
349349
RANGE_UNBOUNDED: Any
350350
RANGE_CURRENT: Any
351351

352-
class Over(ColumnElement):
352+
class Over(ColumnElement[_T]):
353353
__visit_name__: str = ...
354354
order_by: Any = ...
355355
partition_by: Any = ...
@@ -367,7 +367,7 @@ class Over(ColumnElement):
367367
def __reduce__(self): ...
368368
def type(self): ...
369369

370-
class WithinGroup(ColumnElement):
370+
class WithinGroup(ColumnElement[_T]):
371371
__visit_name__: str = ...
372372
order_by: Any = ...
373373
element: Any = ...
@@ -381,7 +381,7 @@ class WithinGroup(ColumnElement):
381381
): ...
382382
def type(self): ...
383383

384-
class FunctionFilter(ColumnElement):
384+
class FunctionFilter(ColumnElement[_T]):
385385
__visit_name__: str = ...
386386
criterion: Any = ...
387387
func: Any = ...
@@ -397,7 +397,7 @@ class FunctionFilter(ColumnElement):
397397
def self_group(self, against: Optional[Any] = ...): ...
398398
def type(self): ...
399399

400-
class Label(roles.LabeledColumnExprRole, ColumnElement):
400+
class Label(roles.LabeledColumnExprRole, ColumnElement[_T]):
401401
__visit_name__: str = ...
402402
name: Any = ...
403403
key: Any = ...
@@ -413,7 +413,7 @@ class Label(roles.LabeledColumnExprRole, ColumnElement):
413413
@property
414414
def foreign_keys(self): ...
415415

416-
class NamedColumn(ColumnElement):
416+
class NamedColumn(ColumnElement[_T]):
417417
is_literal: bool = ...
418418
table: Any = ...
419419
def description(self): ...
@@ -450,7 +450,7 @@ class TableValuedColumn(NamedColumn):
450450
type: Any = ...
451451
def __init__(self, scalar_alias: Any, type_: Any) -> None: ...
452452

453-
class CollationClause(ColumnElement):
453+
class CollationClause(ColumnElement[_T]):
454454
__visit_name__: str = ...
455455
collation: Any = ...
456456
def __init__(self, collation: Any) -> None: ...

sqlalchemy-stubs/sql/schema.pyi

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ RETAIN_SCHEMA: Any
2626
BLANK_SCHEMA: Any
2727
NULL_UNSPECIFIED: Any
2828

29+
_T = TypeVar("_T", bound=type_api.TypeEngine)
30+
2931
class SchemaItem(SchemaEventTarget, visitors.Visitable):
3032
__visit_name__: str = ...
3133
create_drop_stringify_dialect: str = ...
@@ -70,7 +72,7 @@ class Table(DialectKWArgs, SchemaItem, TableClause):
7072
name: Optional[Any] = ...,
7173
): ...
7274

73-
class Column(DialectKWArgs, SchemaItem, ColumnClause):
75+
class Column(DialectKWArgs, SchemaItem, ColumnClause[_T]):
7476
__visit_name__: str = ...
7577
inherit_cache: bool = ...
7678
key: Any = ...

0 commit comments

Comments
 (0)