tortoise / tortoise/tortoise-orm
Typing for ValuesListQuery.__await__() is incorrect
Open
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 5.6k
- Forks
- 516
- Avg merge
- 2d 21h
- Merged PRs (30d)
- 9
Description
Describe the bug
The typing for ValuesListQuery.await() is incorrect.
The current code reads:
def __await__(self) -> Generator[Any, None, Union[List[Any], Tuple]]: ...
However, what it should read is:
def __await__(self) -> Generator[Any, None, Union[List[Union[List[Any], Tuple]], Union[List[Any], Tuple], Any]]: ...
The reasoning is that right now, you can get 3 types of values from a ValuesListQuery:
- A list containing lists
- A list of single values (if flat=True)
- A scalar (if flat=True)
There might be a better way to provide the typing but I'm not sure on it.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by locating ValuesListQuery.await and its existing return annotation. Check the surrounding query implementation and typing conventions, then verify that the annotation covers list-of-lists, flat lists, and scalar results without changing runtime behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- databases
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 50/100