From a073e17537c2aacaac305feadea58d4473ec97f4 Mon Sep 17 00:00:00 2001 From: Takeshi KOMIYA Date: Wed, 14 Feb 2018 22:57:20 +0900 Subject: Use typing.TYPE_CHECKING for typehints --- sphinx/ext/autodoc/directive.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'sphinx/ext/autodoc/directive.py') diff --git a/sphinx/ext/autodoc/directive.py b/sphinx/ext/autodoc/directive.py index 2a7c6b65a..f050b2ac4 100644 --- a/sphinx/ext/autodoc/directive.py +++ b/sphinx/ext/autodoc/directive.py @@ -7,6 +7,8 @@ :license: BSD, see LICENSE for details. """ +from typing import TYPE_CHECKING + from docutils import nodes from docutils.parsers.rst import Directive from docutils.statemachine import ViewList @@ -17,8 +19,7 @@ from sphinx.util import logging from sphinx.util.docutils import switch_source_input from sphinx.util.nodes import nested_parse_with_titles -if False: - # For type annotation +if TYPE_CHECKING: from typing import Any, Dict, List, Set, Type # NOQA from docutils.statemachine import State, StateMachine, StringList # NOQA from docutils.utils import Reporter # NOQA -- cgit v1.2.1