Skip to content

Commit

Permalink
fix: use correct type hinting for QuerySetSingle (#1172)
Browse files Browse the repository at this point in the history
* fix: use MODEL instead of T_co for QuerySetSingle

Fixes #701.

* fix: use T_co over MODEL for QuerySetSingle
  • Loading branch information
AstreaTSS committed Jul 5, 2022
1 parent 4a41044 commit e8da6cf
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ Fixed
- Fixed connection to `Oracle` database by adding database info to DBQ in connection string.
- Fixed ORA-01435 error while using `Oracle` database (#1155)
- Fixed processing of `ssl` option in MySQL connection string.
- Fixed type hinting for `QuerySetSingle`.

0.19.1
------
Expand Down
8 changes: 4 additions & 4 deletions tortoise/queryset.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,16 +64,16 @@ class QuerySetSingle(Protocol[T_co]):
def __await__(self) -> Generator[Any, None, T_co]:
... # pragma: nocoverage

def prefetch_related(self, *args: Union[str, Prefetch]) -> "QuerySetSingle[MODEL]":
def prefetch_related(self, *args: Union[str, Prefetch]) -> "QuerySetSingle[T_co]":
... # pragma: nocoverage

def select_related(self, *args: str) -> "QuerySetSingle[MODEL]":
def select_related(self, *args: str) -> "QuerySetSingle[T_co]":
... # pragma: nocoverage

def annotate(self, **kwargs: Function) -> "QuerySetSingle[MODEL]":
def annotate(self, **kwargs: Function) -> "QuerySetSingle[T_co]":
... # pragma: nocoverage

def only(self, *fields_for_select: str) -> "QuerySetSingle[MODEL]":
def only(self, *fields_for_select: str) -> "QuerySetSingle[T_co]":
... # pragma: nocoverage

def values_list(self, *fields_: str, flat: bool = False) -> "ValuesListQuery":
Expand Down

0 comments on commit e8da6cf

Please sign in to comment.