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/pycode/parser.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'sphinx/pycode/parser.py') diff --git a/sphinx/pycode/parser.py b/sphinx/pycode/parser.py index f15da664a..c5d9be320 100644 --- a/sphinx/pycode/parser.py +++ b/sphinx/pycode/parser.py @@ -15,11 +15,11 @@ import re import tokenize from token import NAME, NEWLINE, INDENT, DEDENT, NUMBER, OP, STRING from tokenize import COMMENT, NL +from typing import TYPE_CHECKING from six import PY2, text_type -if False: - # For type annotation +if TYPE_CHECKING: from typing import Any, Dict, IO, List, Tuple # NOQA comment_re = re.compile(u'^\\s*#: ?(.*)\r?\n?$') -- cgit v1.2.1