tortoise-orm icon indicating copy to clipboard operation
tortoise-orm copied to clipboard

Typing for ValuesListQuery.__await__() is incorrect

Open PythonCoderAS opened this issue 3 years ago • 0 comments

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:

  1. A list containing lists
  2. A list of single values (if flat=True)
  3. A scalar (if flat=True)

There might be a better way to provide the typing but I'm not sure on it.

PythonCoderAS avatar Apr 23 '22 02:04 PythonCoderAS