document annotations

This commit is contained in:
Damien Elmes 2020-02-12 08:01:33 +10:00
parent 60becbf480
commit 6bd61d3d85

View File

@ -51,10 +51,23 @@ of a line to silence the spurious errors.
# type: ignore # type: ignore
In cases where you have two modules that reference each other, you can't simply In cases where you have two modules that reference each other, you can fix the
import the types from each module into the other one, as it can cause a cyclic import cycle by using fully qualified names in the types, and enabling
import. An example of how to work around this can be seen at annotations. For example, instead of
https://github.com/dae/anki/commit/ed0b3d337458d7161811547932b6476f2d4bc887
from aqt.browser import Browser
def myfunc(b: Browser) -> None:
pass
use the following instead:
from __future__ import annotations
import aqt
def myfunc(b: aqt.browser.Browser) -> None:
pass
Hooks Hooks
------- -------