Skip to content

Commit

Permalink
Fix single item query return type (dropbox#199)
Browse files Browse the repository at this point in the history
Co-authored-by: Ivan Levkivskyi <[email protected]>
  • Loading branch information
2 people authored and Boryslav Larin committed Jan 15, 2021
1 parent 3941f82 commit d1003ef
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions sqlalchemy-stubs/orm/session.pyi
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from typing import Any, Optional, Type, TypeVar, Union, overload
from typing import Any, Optional, Tuple, Type, TypeVar, overload

from sqlalchemy import Column
from sqlalchemy.orm.query import Query
Expand Down Expand Up @@ -66,9 +66,11 @@ class Session(_SessionClassMethods):
def bind_table(self, table, bind): ...
def get_bind(self, mapper: Optional[Any] = ..., clause: Optional[Any] = ...): ...
@overload
def query(self, entity: Union[Type[_T], Column[_T]], **kwargs) -> Query[_T]: ...
def query(self, entity: Type[_T], **kwargs) -> Query[_T]: ...
@overload
def query(self, *entities, **kwargs) -> Query: ...
def query(self, entity: Column[_T], **kwargs) -> Query[Tuple[_T]]: ...
@overload
def query(self, *entities, **kwargs) -> Query[Any]: ... # plugin is needed for precise type
@property
def no_autoflush(self): ...
def refresh(self, instance, attribute_names: Optional[Any] = ..., lockmode: Optional[Any] = ...): ...
Expand Down

0 comments on commit d1003ef

Please sign in to comment.