This PR adds type annotations to the query api.
In the past when someone uses fb.query(...).join(...).all() the type of the returned value of all() was Any which is not very usefull for a beginner who is not so familiar how the api works and what is returned. This will change with this PR
If you run it with mypy example.py, mypy can infer the correct type of the result now
example.py:17: note: Revealed type is "typing.Generator[Tuple[example.P6, example.P7], None, None]"
example.py:20: note: Revealed type is "typing.Generator[Tuple[example.P6, builtins.int], None, None]"
example.py:23: note: Revealed type is "typing.Generator[Tuple[example.P6, typing.Iterator[Tuple[example.P6, example.P7]]], None, None]"
example.py:26: note: Revealed type is "typing.Iterator[Tuple[example.P6, builtins.int]]"
example.py:29: note: Revealed type is "typing.Generator[Tuple[Tuple[builtins.str, builtins.int], typing.Iterator[Tuple[example.P6, builtins.int]]], None, None]"
and also the correct type is shown in VS-Code
I also added a small TestCase for testing the correct type infered by mypy, but it will be skipped if mypy is not installed.
This PR adds type annotations to the query api. In the past when someone uses
fb.query(...).join(...).all()
the type of the returned value ofall()
wasAny
which is not very usefull for a beginner who is not so familiar how the api works and what is returned. This will change with this PRLet's take a look at the examples below:
If you run it with
mypy example.py
, mypy can infer the correct type of the result nowand also the correct type is shown in VS-Code![grafik](https://user-images.githubusercontent.com/72799603/170471200-e3bdd644-747c-4b1e-89e4-08d06e29272b.png)
I also added a small TestCase for testing the correct type infered by mypy, but it will be skipped if mypy is not installed.
closes #62