diff options
Diffstat (limited to 'sphinx/pycode')
-rw-r--r-- | sphinx/pycode/__init__.py | 2 | ||||
-rw-r--r-- | sphinx/pycode/nodes.py | 6 | ||||
-rw-r--r-- | sphinx/pycode/pgen2/grammar.py | 2 | ||||
-rw-r--r-- | sphinx/pycode/pgen2/parse.py | 2 | ||||
-rw-r--r-- | sphinx/pycode/pgen2/pgen.py | 2 | ||||
-rw-r--r-- | sphinx/pycode/pgen2/tokenize.py | 4 |
6 files changed, 13 insertions, 5 deletions
diff --git a/sphinx/pycode/__init__.py b/sphinx/pycode/__init__.py index d7c81e6f0..48c62ecf7 100644 --- a/sphinx/pycode/__init__.py +++ b/sphinx/pycode/__init__.py @@ -26,7 +26,7 @@ from sphinx.util.docstrings import prepare_docstring, prepare_commentdoc if False: # For type annotation - from typing import Any, Tuple # NOQA + from typing import Any, Dict, List, Tuple # NOQA # load the Python grammar diff --git a/sphinx/pycode/nodes.py b/sphinx/pycode/nodes.py index 099fc2cf2..b4b681d78 100644 --- a/sphinx/pycode/nodes.py +++ b/sphinx/pycode/nodes.py @@ -9,6 +9,10 @@ :license: BSD, see LICENSE for details. """ +if False: + # For type annotation + from typing import Callable # NOQA + class BaseNode(object): """ @@ -29,7 +33,7 @@ class BaseNode(object): return NotImplemented return not self._eq(other) - __hash__ = None # type: str + __hash__ = None # type: Callable[[object], int] def get_prev_sibling(self): """Return previous child in parent's children, or None.""" diff --git a/sphinx/pycode/pgen2/grammar.py b/sphinx/pycode/pgen2/grammar.py index cd6a435d5..ac276776e 100644 --- a/sphinx/pycode/pgen2/grammar.py +++ b/sphinx/pycode/pgen2/grammar.py @@ -21,7 +21,7 @@ from sphinx.pycode.pgen2 import token if False: # For type annotation - from typing import Tuple # NOQA + from typing import Dict, List, Tuple # NOQA class Grammar(object): diff --git a/sphinx/pycode/pgen2/parse.py b/sphinx/pycode/pgen2/parse.py index 43b88b519..660a47e68 100644 --- a/sphinx/pycode/pgen2/parse.py +++ b/sphinx/pycode/pgen2/parse.py @@ -15,7 +15,7 @@ from sphinx.pycode.pgen2 import token if False: # For type annotation - from typing import Any, Tuple # NOQA + from typing import Any, List, Set, Tuple # NOQA class ParseError(Exception): """Exception to signal the parser is stuck.""" diff --git a/sphinx/pycode/pgen2/pgen.py b/sphinx/pycode/pgen2/pgen.py index 0106763d0..8d9cc786a 100644 --- a/sphinx/pycode/pgen2/pgen.py +++ b/sphinx/pycode/pgen2/pgen.py @@ -11,7 +11,7 @@ from sphinx.pycode.pgen2 import grammar, token, tokenize if False: # For type annotation - from typing import Any, Tuple # NOQA + from typing import Any, Dict, List, Tuple # NOQA class PgenGrammar(grammar.Grammar): diff --git a/sphinx/pycode/pgen2/tokenize.py b/sphinx/pycode/pgen2/tokenize.py index cbe64a581..8b533d422 100644 --- a/sphinx/pycode/pgen2/tokenize.py +++ b/sphinx/pycode/pgen2/tokenize.py @@ -37,6 +37,10 @@ from six import PY3 from sphinx.pycode.pgen2.token import * from sphinx.pycode.pgen2 import token +if False: + # For type annotation + from typing import List # NOQA + __all__ = [x for x in dir(token) if x[0] != '_'] + ["tokenize", "generate_tokens", "untokenize"] del token |