From 9909daec8e3089e350decf8c1a837a2f6fe95cb9 Mon Sep 17 00:00:00 2001 From: Marc Mueller <30130371+cdce8p@users.noreply.github.com> Date: Thu, 16 Dec 2021 13:36:33 +0100 Subject: Upgrade mypy to 0.920 (#5535) --- .pre-commit-config.yaml | 2 +- pylint/extensions/__init__.py | 2 +- pylint/reporters/__init__.py | 2 +- requirements_test_pre_commit.txt | 2 +- tests/config/unittest_config.py | 6 +++++- 5 files changed, 9 insertions(+), 5 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 7d5596eed..6c3bd79b4 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -77,7 +77,7 @@ repos: types: [text] # necessary to include ChangeLog file files: ^(ChangeLog|doc/(.*/)*.*\.rst) - repo: https://github.com/pre-commit/mirrors-mypy - rev: v0.910-1 + rev: v0.920 hooks: - id: mypy name: mypy diff --git a/pylint/extensions/__init__.py b/pylint/extensions/__init__.py index 42477a4b3..8b5fa9132 100644 --- a/pylint/extensions/__init__.py +++ b/pylint/extensions/__init__.py @@ -11,7 +11,7 @@ if TYPE_CHECKING: def initialize(linter: "PyLinter") -> None: """Initialize linter with checkers in the extensions directory""" - register_plugins(linter, __path__[0]) # type: ignore[name-defined] # Fixed in https://github.com/python/mypy/pull/9454 + register_plugins(linter, __path__[0]) __all__ = ["initialize"] diff --git a/pylint/reporters/__init__.py b/pylint/reporters/__init__.py index 271975bb5..420154d54 100644 --- a/pylint/reporters/__init__.py +++ b/pylint/reporters/__init__.py @@ -37,7 +37,7 @@ if TYPE_CHECKING: def initialize(linter: "PyLinter") -> None: """initialize linter with reporters in this package""" - utils.register_plugins(linter, __path__[0]) # type: ignore[name-defined] # Fixed in https://github.com/python/mypy/pull/9454 + utils.register_plugins(linter, __path__[0]) __all__ = [ diff --git a/requirements_test_pre_commit.txt b/requirements_test_pre_commit.txt index 217002d4d..0823f177c 100644 --- a/requirements_test_pre_commit.txt +++ b/requirements_test_pre_commit.txt @@ -4,4 +4,4 @@ black==21.12b0 flake8==4.0.1 flake8-typing-imports==1.11.0 isort==5.10.1 -mypy==0.910 +mypy==0.920 diff --git a/tests/config/unittest_config.py b/tests/config/unittest_config.py index b10c686e4..d98b2a7a1 100644 --- a/tests/config/unittest_config.py +++ b/tests/config/unittest_config.py @@ -16,6 +16,7 @@ import re import sre_constants +import sys from typing import Dict, Tuple, Type import pytest @@ -25,7 +26,10 @@ from pylint.checkers import BaseChecker from pylint.testutils import CheckerTestCase, set_config from pylint.utils.utils import get_global_option -RE_PATTERN_TYPE = getattr(re, "Pattern", getattr(re, "_pattern_type", None)) +if sys.version_info >= (3, 7): + RE_PATTERN_TYPE = re.Pattern +else: + RE_PATTERN_TYPE = re._pattern_type # pylint: disable=no-member def test__regexp_validator_valid() -> None: -- cgit v1.2.1