diff options
-rw-r--r-- | pylint/checkers/imports.py | 4 | ||||
-rw-r--r-- | pylint/checkers/stdlib.py | 4 | ||||
-rw-r--r-- | pylint/checkers/utils.py | 2 | ||||
-rw-r--r-- | pylint/graph.py | 5 | ||||
-rw-r--r-- | pylint/message/message_definition.py | 2 | ||||
-rw-r--r-- | pylint/message/message_handler_mix_in.py | 2 | ||||
-rw-r--r-- | setup.cfg | 1 | ||||
-rw-r--r-- | tests/test_self.py | 2 |
8 files changed, 13 insertions, 9 deletions
diff --git a/pylint/checkers/imports.py b/pylint/checkers/imports.py index d887cd3ff..05f1a28e9 100644 --- a/pylint/checkers/imports.py +++ b/pylint/checkers/imports.py @@ -51,7 +51,7 @@ import copy import os import sys from distutils import sysconfig -from typing import Any, Dict, List, Set, Tuple, Union +from typing import Any, Dict, List, Optional, Set, Tuple, Union import astroid from astroid import nodes @@ -424,7 +424,7 @@ class ImportsChecker(DeprecatedMixin, BaseChecker): ) def __init__( - self, linter: PyLinter = None + self, linter: Optional[PyLinter] = None ): # pylint: disable=super-init-not-called # See https://github.com/PyCQA/pylint/issues/4941 BaseChecker.__init__(self, linter) self.stats: CheckerStats = {} diff --git a/pylint/checkers/stdlib.py b/pylint/checkers/stdlib.py index 508c358e1..0eb47296e 100644 --- a/pylint/checkers/stdlib.py +++ b/pylint/checkers/stdlib.py @@ -39,7 +39,7 @@ import sys from collections.abc import Iterable -from typing import Any, Dict, Set +from typing import Any, Dict, Optional, Set import astroid from astroid import nodes @@ -447,7 +447,7 @@ class StdlibChecker(DeprecatedMixin, BaseChecker): } def __init__( - self, linter: PyLinter = None + self, linter: Optional[PyLinter] = None ): # pylint: disable=super-init-not-called # See https://github.com/PyCQA/pylint/issues/4941 BaseChecker.__init__(self, linter) self._deprecated_methods: Set[Any] = set() diff --git a/pylint/checkers/utils.py b/pylint/checkers/utils.py index 87c12433d..d37c8ab5d 100644 --- a/pylint/checkers/utils.py +++ b/pylint/checkers/utils.py @@ -674,7 +674,7 @@ def is_attr_private(attrname: str) -> Optional[Match[str]]: def get_argument_from_call( - call_node: nodes.Call, position: int = None, keyword: str = None + call_node: nodes.Call, position: Optional[int] = None, keyword: Optional[str] = None ) -> nodes.Name: """Returns the specified argument from a function call. diff --git a/pylint/graph.py b/pylint/graph.py index 2dc3bae99..038db7e4e 100644 --- a/pylint/graph.py +++ b/pylint/graph.py @@ -26,6 +26,7 @@ import shutil import subprocess import sys import tempfile +from typing import Optional def target_info_from_filename(filename): @@ -82,7 +83,9 @@ class DotBackend: source = property(get_source) - def generate(self, outputfile: str = None, mapfile: str = None) -> str: + def generate( + self, outputfile: Optional[str] = None, mapfile: Optional[str] = None + ) -> str: """Generates a graph file. :param str outputfile: filename and path [defaults to graphname.png] diff --git a/pylint/message/message_definition.py b/pylint/message/message_definition.py index 30dacb32f..31fbeb08d 100644 --- a/pylint/message/message_definition.py +++ b/pylint/message/message_definition.py @@ -20,7 +20,7 @@ class MessageDefinition: scope: str, minversion: Optional[Tuple[int, int]] = None, maxversion: Optional[Tuple[int, int]] = None, - old_names: List[Tuple[str, str]] = None, + old_names: Optional[List[Tuple[str, str]]] = None, ): self.checker_name = checker.name self.check_msgid(msgid) diff --git a/pylint/message/message_handler_mix_in.py b/pylint/message/message_handler_mix_in.py index 90f40235a..185658d4a 100644 --- a/pylint/message/message_handler_mix_in.py +++ b/pylint/message/message_handler_mix_in.py @@ -74,7 +74,7 @@ class MessagesHandlerMixIn: self, msgid: str, scope: str = "package", - line: Union[bool, int] = None, + line: Union[bool, int, None] = None, ignore_unknown: bool = False, ): if not line: @@ -83,6 +83,7 @@ skip_glob = tests/functional/**,tests/input/**,tests/extensions/data/**,tests/re src_paths = pylint [mypy] +no_implicit_optional = True scripts_are_modules = True warn_unused_ignores = True diff --git a/tests/test_self.py b/tests/test_self.py index 2b5daef84..a4a3ac794 100644 --- a/tests/test_self.py +++ b/tests/test_self.py @@ -141,7 +141,7 @@ class TestRunTC: args: List[str], reporter: Any = None, out: Optional[StringIO] = None, - code: int = None, + code: Optional[int] = None, ) -> None: if out is None: out = StringIO() |