diff options
author | Takeshi KOMIYA <i.tkomiya@gmail.com> | 2017-03-03 12:19:09 +0900 |
---|---|---|
committer | Takeshi KOMIYA <i.tkomiya@gmail.com> | 2017-03-03 23:17:34 +0900 |
commit | 554199d30e418f72f215fae65924b47249d2544c (patch) | |
tree | fd952e21a8f4e9dabf91c5e3731dea3712ade006 /sphinx/environment | |
parent | 28b1aceefedbb9c3a12d6ba7c712df8ad5e98db8 (diff) | |
download | sphinx-git-554199d30e418f72f215fae65924b47249d2544c.tar.gz |
Upgrade to mypy-0.5
Diffstat (limited to 'sphinx/environment')
-rw-r--r-- | sphinx/environment/__init__.py | 10 | ||||
-rw-r--r-- | sphinx/environment/adapters/indexentries.py | 2 | ||||
-rw-r--r-- | sphinx/environment/adapters/toctree.py | 2 | ||||
-rw-r--r-- | sphinx/environment/collectors/__init__.py | 1 | ||||
-rw-r--r-- | sphinx/environment/collectors/asset.py | 2 | ||||
-rw-r--r-- | sphinx/environment/collectors/dependencies.py | 1 | ||||
-rw-r--r-- | sphinx/environment/collectors/indexentries.py | 1 | ||||
-rw-r--r-- | sphinx/environment/collectors/metadata.py | 1 | ||||
-rw-r--r-- | sphinx/environment/collectors/title.py | 1 | ||||
-rw-r--r-- | sphinx/environment/collectors/toctree.py | 2 |
10 files changed, 14 insertions, 9 deletions
diff --git a/sphinx/environment/__init__.py b/sphinx/environment/__init__.py index 3e6e49ff3..3a46fa809 100644 --- a/sphinx/environment/__init__.py +++ b/sphinx/environment/__init__.py @@ -51,7 +51,7 @@ from sphinx.environment.adapters.toctree import TocTree if False: # For type annotation - from typing import Any, Callable, Iterator, Pattern, Tuple, Type, Union # NOQA + from typing import Any, Callable, Dict, Iterator, List, Pattern, Set, Tuple, Type, Union # NOQA from sphinx.application import Sphinx # NOQA from sphinx.builders import Builder # NOQA from sphinx.config import Config # NOQA @@ -320,8 +320,8 @@ class BuildEnvironment(object): if filename.startswith(self.srcdir): filename = filename[len(self.srcdir) + 1:] for suffix in self.config.source_suffix: - if fnmatch.fnmatch(filename, '*' + suffix): # type: ignore - return filename[:-len(suffix)] # type: ignore + if fnmatch.fnmatch(filename, '*' + suffix): + return filename[:-len(suffix)] else: # the file does not have docname return None @@ -338,14 +338,14 @@ class BuildEnvironment(object): docname = docname.replace(SEP, path.sep) if suffix is None: candidate_suffix = None # type: unicode - for candidate_suffix in self.config.source_suffix: # type: ignore + for candidate_suffix in self.config.source_suffix: if path.isfile(path.join(self.srcdir, docname) + candidate_suffix): suffix = candidate_suffix break else: # document does not exist - suffix = self.config.source_suffix[0] # type: ignore + suffix = self.config.source_suffix[0] if base is True: return path.join(self.srcdir, docname) + suffix elif base is None: diff --git a/sphinx/environment/adapters/indexentries.py b/sphinx/environment/adapters/indexentries.py index 13a128546..31ec58301 100644 --- a/sphinx/environment/adapters/indexentries.py +++ b/sphinx/environment/adapters/indexentries.py @@ -20,7 +20,7 @@ from sphinx.util import iteritems, split_into, logging if False: # For type annotation - from typing import Any, Pattern, Tuple # NOQA + from typing import Any, Dict, Pattern, List, Tuple # NOQA from sphinx.builders import Builder # NOQA from sphinx.environment import BuildEnvironment # NOQA diff --git a/sphinx/environment/adapters/toctree.py b/sphinx/environment/adapters/toctree.py index bde8d1ac4..458eefd77 100644 --- a/sphinx/environment/adapters/toctree.py +++ b/sphinx/environment/adapters/toctree.py @@ -19,7 +19,7 @@ from sphinx.util.nodes import clean_astext, process_only_nodes if False: # For type annotation - from typing import Any # NOQA + from typing import Any, Dict, List # NOQA from sphinx.builders import Builder # NOQA from sphinx.environment import BuildEnvironment # NOQA diff --git a/sphinx/environment/collectors/__init__.py b/sphinx/environment/collectors/__init__.py index b8d73ad1f..45add6c4e 100644 --- a/sphinx/environment/collectors/__init__.py +++ b/sphinx/environment/collectors/__init__.py @@ -13,6 +13,7 @@ from six import itervalues if False: # For type annotation + from typing import Dict, List, Set # NOQA from docutils import nodes # NOQA from sphinx.sphinx import Sphinx # NOQA from sphinx.environment import BuildEnvironment # NOQA diff --git a/sphinx/environment/collectors/asset.py b/sphinx/environment/collectors/asset.py index 38deeeca4..73dd16869 100644 --- a/sphinx/environment/collectors/asset.py +++ b/sphinx/environment/collectors/asset.py @@ -26,7 +26,7 @@ from sphinx.util.images import guess_mimetype if False: # For type annotation - from typing import Tuple # NOQA + from typing import Dict, List, Set, Tuple # NOQA from docutils import nodes # NOQA from sphinx.sphinx import Sphinx # NOQA from sphinx.environment import BuildEnvironment # NOQA diff --git a/sphinx/environment/collectors/dependencies.py b/sphinx/environment/collectors/dependencies.py index b4d35caf7..ebfefe154 100644 --- a/sphinx/environment/collectors/dependencies.py +++ b/sphinx/environment/collectors/dependencies.py @@ -18,6 +18,7 @@ from sphinx.environment.collectors import EnvironmentCollector if False: # For type annotation + from typing import Set # NOQA from docutils import nodes # NOQA from sphinx.sphinx import Sphinx # NOQA from sphinx.environment import BuildEnvironment # NOQA diff --git a/sphinx/environment/collectors/indexentries.py b/sphinx/environment/collectors/indexentries.py index c9aeda7e1..596c98c09 100644 --- a/sphinx/environment/collectors/indexentries.py +++ b/sphinx/environment/collectors/indexentries.py @@ -15,6 +15,7 @@ from sphinx.environment.collectors import EnvironmentCollector if False: # For type annotation + from typing import Set # NOQA from docutils import nodes # NOQA from sphinx.applicatin import Sphinx # NOQA from sphinx.environment import BuildEnvironment # NOQA diff --git a/sphinx/environment/collectors/metadata.py b/sphinx/environment/collectors/metadata.py index 7a15cc614..4c700b4f2 100644 --- a/sphinx/environment/collectors/metadata.py +++ b/sphinx/environment/collectors/metadata.py @@ -15,6 +15,7 @@ from sphinx.environment.collectors import EnvironmentCollector if False: # For type annotation + from typing import Set # NOQA from docutils import nodes # NOQA from sphinx.sphinx import Sphinx # NOQA from sphinx.environment import BuildEnvironment # NOQA diff --git a/sphinx/environment/collectors/title.py b/sphinx/environment/collectors/title.py index a5316fe94..fca394c35 100644 --- a/sphinx/environment/collectors/title.py +++ b/sphinx/environment/collectors/title.py @@ -16,6 +16,7 @@ from sphinx.transforms import SphinxContentsFilter if False: # For type annotation + from typing import Set # NOQA from docutils import nodes # NOQA from sphinx.sphinx import Sphinx # NOQA from sphinx.environment import BuildEnvironment # NOQA diff --git a/sphinx/environment/collectors/toctree.py b/sphinx/environment/collectors/toctree.py index 5c9ed5472..bd3298391 100644 --- a/sphinx/environment/collectors/toctree.py +++ b/sphinx/environment/collectors/toctree.py @@ -21,7 +21,7 @@ from sphinx.environment.collectors import EnvironmentCollector if False: # For type annotation - from typing import Any, Tuple # NOQA + from typing import Any, Dict, List, Set, Tuple # NOQA from sphinx.application import Sphinx # NOQA from sphinx.builders import Builder # NOQA from sphinx.environment import BuildEnvironment # NOQA |