Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix mypy violations (for mypy-0.740) #6747

Merged
merged 1 commit into from Oct 20, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion setup.py
Expand Up @@ -47,7 +47,7 @@
'html5lib',
'flake8>=3.5.0',
'flake8-import-order',
'mypy>=0.730',
'mypy>=0.740',
'docutils-stubs',
],
}
Expand Down
5 changes: 3 additions & 2 deletions sphinx/domains/cpp.py
Expand Up @@ -32,7 +32,8 @@

if False:
# For type annotation
from typing import Any, Callable, Dict, Iterator, List, Match, Pattern, Tuple, Union # NOQA
from docutils.nodes import TextElement
from typing import Any, Callable, Dict, Iterator, List, Match, Pattern, Tuple, Type, Union # NOQA
from sphinx.application import Sphinx # NOQA
from sphinx.builders import Builder # NOQA
from sphinx.config import Config # NOQA
Expand Down Expand Up @@ -6980,7 +6981,7 @@ def __init__(self, asCode):
if asCode:
# render the expression as inline code
self.class_type = 'cpp-expr'
self.node_type = nodes.literal
self.node_type = nodes.literal # type: Type[TextElement]
else:
# render the expression as inline text
self.class_type = 'cpp-texpr'
Expand Down
2 changes: 1 addition & 1 deletion sphinx/util/docutils.py
Expand Up @@ -187,7 +187,7 @@ def __init__(self, env: "BuildEnvironment") -> None:
def __enter__(self) -> None:
self.enable()

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: # type: ignore # NOQA
self.disable()
return False

Expand Down
4 changes: 2 additions & 2 deletions sphinx/util/matching.py
Expand Up @@ -9,7 +9,7 @@
"""

import re
from typing import Callable, Dict, List, Match, Pattern
from typing import Callable, Dict, Iterable, List, Match, Pattern

from sphinx.util.osutil import canon_path

Expand Down Expand Up @@ -96,7 +96,7 @@ def patmatch(name: str, pat: str) -> Match[str]:
return _pat_cache[pat].match(name)


def patfilter(names: List[str], pat: str) -> List[str]:
def patfilter(names: Iterable[str], pat: str) -> List[str]:
"""Return the subset of the list NAMES that match PAT.

Adapted from fnmatch module.
Expand Down
2 changes: 1 addition & 1 deletion sphinx/util/pycompat.py
Expand Up @@ -55,7 +55,7 @@ class UnicodeMixin:
def __str__(self):
warnings.warn('UnicodeMixin is deprecated',
RemovedInSphinx40Warning, stacklevel=2)
return self.__unicode__()
return self.__unicode__() # type: ignore


def execfile_(filepath: str, _globals: Any, open: Callable = open) -> None:
Expand Down