diff options
author | Takeshi KOMIYA <i.tkomiya@gmail.com> | 2019-07-13 23:29:38 +0900 |
---|---|---|
committer | Takeshi KOMIYA <i.tkomiya@gmail.com> | 2019-07-13 23:46:17 +0900 |
commit | 0c48a28ad7216ee064b0db564745d749c049bfd5 (patch) | |
tree | 2bc2f13992c930c00bd3b60ea3e2c27c31e659cd /sphinx/util/osutil.py | |
parent | 0bc530f1b7b3303e0f53e42010b629d67e79b835 (diff) | |
download | sphinx-git-0c48a28ad7216ee064b0db564745d749c049bfd5.tar.gz |
Fix type annotation for python 3.5.1
Diffstat (limited to 'sphinx/util/osutil.py')
-rw-r--r-- | sphinx/util/osutil.py | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/sphinx/util/osutil.py b/sphinx/util/osutil.py index 3751fcc08..f9c7ce6c4 100644 --- a/sphinx/util/osutil.py +++ b/sphinx/util/osutil.py @@ -19,11 +19,15 @@ import time import warnings from io import StringIO from os import path -from typing import Any, Generator, Iterator, List, Tuple, Type +from typing import Any, Generator, Iterator, List, Tuple from sphinx.deprecation import RemovedInSphinx30Warning, RemovedInSphinx40Warning from sphinx.testing.path import path as Path +if False: + # For type annotation + from typing import Type # for python3.5.1 + # Errnos that we need. EEXIST = getattr(errno, 'EEXIST', 0) # RemovedInSphinx40Warning ENOENT = getattr(errno, 'ENOENT', 0) # RemovedInSphinx40Warning @@ -248,7 +252,7 @@ class FileAvoidWrite: def __enter__(self) -> "FileAvoidWrite": return self - def __exit__(self, exc_type: Type[Exception], exc_value: Exception, traceback: Any) -> bool: # NOQA + def __exit__(self, exc_type: "Type[Exception]", exc_value: Exception, traceback: Any) -> bool: # NOQA self.close() return True |