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

Use --py39-plus and --full-reorder in python-typing-update #6313

Merged
merged 8 commits into from
Apr 14, 2022
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pylint/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

import os
import sys
from typing import Sequence
from collections.abc import Sequence

from pylint.__pkginfo__ import __version__

Expand Down
5 changes: 4 additions & 1 deletion pylint/checkers/base/basic_error_checker.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,11 @@

"""Basic Error checker from the basic checker."""

from __future__ import annotations

import itertools
from typing import Any, Iterator
from collections.abc import Iterator
cdce8p marked this conversation as resolved.
Show resolved Hide resolved
from typing import Any

import astroid
from astroid import nodes
Expand Down
2 changes: 1 addition & 1 deletion pylint/checkers/base/name_checker/checker.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import re
import sys
from enum import Enum, auto
from typing import Pattern
from re import Pattern

import astroid
from astroid import nodes
Expand Down
2 changes: 1 addition & 1 deletion pylint/checkers/classes/class_checker.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import collections
import sys
from itertools import chain, zip_longest
from typing import Pattern
from re import Pattern

import astroid
from astroid import bases, nodes
Expand Down
3 changes: 2 additions & 1 deletion pylint/checkers/deprecated.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@

from __future__ import annotations

from collections.abc import Container, Iterable
from itertools import chain
from typing import Any, Container, Iterable
from typing import Any

import astroid
from astroid import nodes
Expand Down
3 changes: 2 additions & 1 deletion pylint/checkers/design_analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
import re
import sys
from collections import defaultdict
from typing import TYPE_CHECKING, Iterator, List, cast
from collections.abc import Iterator
from typing import TYPE_CHECKING, List, cast

import astroid
from astroid import nodes
Expand Down
3 changes: 2 additions & 1 deletion pylint/checkers/refactoring/refactoring_checker.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@
import itertools
import sys
import tokenize
from collections.abc import Iterator
from functools import reduce
from typing import Iterator, NamedTuple
from typing import NamedTuple

import astroid
from astroid import nodes
Expand Down
3 changes: 1 addition & 2 deletions pylint/checkers/similar.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,14 @@
import sys
import warnings
from collections import defaultdict
from collections.abc import Generator, Iterable
from getopt import getopt
from io import BufferedIOBase, BufferedReader, BytesIO
from itertools import chain, groupby
from typing import (
TYPE_CHECKING,
Any,
Dict,
Generator,
Iterable,
List,
NamedTuple,
NewType,
Expand Down
3 changes: 2 additions & 1 deletion pylint/checkers/spelling.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
import os
import re
import tokenize
from typing import TYPE_CHECKING, Pattern
from re import Pattern
from typing import TYPE_CHECKING

from astroid import nodes

Expand Down
4 changes: 3 additions & 1 deletion pylint/checkers/strings.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@
import numbers
import re
import tokenize
from typing import TYPE_CHECKING, Counter, Iterable
from collections import Counter
from collections.abc import Iterable
from typing import TYPE_CHECKING

import astroid
from astroid import nodes
Expand Down
5 changes: 3 additions & 2 deletions pylint/checkers/typecheck.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,10 @@
import sys
import types
from collections import deque
from collections.abc import Sequence
from collections.abc import Callable, Iterator, Sequence
from functools import singledispatch
from typing import TYPE_CHECKING, Any, Callable, Iterator, Pattern, Union
from re import Pattern
from typing import TYPE_CHECKING, Any, Union

import astroid.exceptions
from astroid import bases, nodes
Expand Down
3 changes: 2 additions & 1 deletion pylint/checkers/unicode.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,10 @@
import io
import re
from collections import OrderedDict
from collections.abc import Iterable
from functools import lru_cache
from tokenize import detect_encoding
from typing import Iterable, NamedTuple, TypeVar
from typing import NamedTuple, TypeVar

from astroid import nodes

Expand Down
4 changes: 3 additions & 1 deletion pylint/checkers/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,10 @@
import re
import string
import warnings
from collections.abc import Callable, Iterable
from functools import lru_cache, partial
from typing import Callable, Iterable, Match, TypeVar
from re import Match
from typing import TypeVar

import _string
import astroid.objects
Expand Down
3 changes: 2 additions & 1 deletion pylint/checkers/variables.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,10 @@
import os
import re
import sys
from collections.abc import Iterable, Iterator
from enum import Enum
from functools import lru_cache
from typing import TYPE_CHECKING, Any, DefaultDict, Iterable, Iterator, NamedTuple
from typing import TYPE_CHECKING, Any, DefaultDict, NamedTuple

import astroid
from astroid import nodes
Expand Down
3 changes: 2 additions & 1 deletion pylint/config/argument.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
import pathlib
import re
import sys
from typing import Any, Callable, Pattern, Sequence, Tuple, Union
from collections.abc import Callable
from typing import Any, Pattern, Sequence, Tuple, Union

from pylint import interfaces
from pylint import utils as pylint_utils
Expand Down
3 changes: 2 additions & 1 deletion pylint/config/arguments_provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@

import optparse # pylint: disable=deprecated-module
import warnings
from typing import Any, Iterator
from collections.abc import Iterator
from typing import Any

from pylint.config.arguments_manager import _ArgumentsManager
from pylint.typing import OptionDict, Options
Expand Down
3 changes: 2 additions & 1 deletion pylint/config/callback_actions.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@
import argparse
import sys
import warnings
from collections.abc import Sequence
from pathlib import Path
from typing import TYPE_CHECKING, Any, Sequence
from typing import TYPE_CHECKING, Any

from pylint import exceptions, extensions, interfaces, utils

Expand Down
3 changes: 2 additions & 1 deletion pylint/config/deprecation_actions.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@

import argparse
import warnings
from typing import Any, Sequence
from collections.abc import Sequence
from typing import Any


class _OldNamesAction(argparse._StoreAction):
Expand Down
2 changes: 1 addition & 1 deletion pylint/config/find_default_config_files.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
import os
import sys
import warnings
from collections.abc import Iterator
from pathlib import Path
from typing import Iterator

if sys.version_info >= (3, 11):
import tomllib
Expand Down
2 changes: 1 addition & 1 deletion pylint/config/option.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import optparse # pylint: disable=deprecated-module
import pathlib
import re
from typing import Pattern
from re import Pattern

from pylint import utils

Expand Down
3 changes: 2 additions & 1 deletion pylint/config/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@

import re
import warnings
from collections.abc import Callable
from pathlib import Path
from typing import TYPE_CHECKING, Any, Callable
from typing import TYPE_CHECKING, Any

from pylint import extensions, utils
from pylint.config.argument import (
Expand Down
2 changes: 1 addition & 1 deletion pylint/epylint.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@
import os
import shlex
import sys
from collections.abc import Sequence
from io import StringIO
from subprocess import PIPE, Popen
from typing import Sequence


def _get_env():
Expand Down
3 changes: 2 additions & 1 deletion pylint/extensions/comparetozero.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
from __future__ import annotations

import itertools
from typing import TYPE_CHECKING, Any, Iterable
from collections.abc import Iterable
from typing import TYPE_CHECKING, Any

import astroid
from astroid import nodes
Expand Down
3 changes: 2 additions & 1 deletion pylint/extensions/emptystring.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
from __future__ import annotations

import itertools
from typing import TYPE_CHECKING, Any, Iterable
from collections.abc import Iterable
from typing import TYPE_CHECKING, Any

from astroid import nodes

Expand Down
2 changes: 1 addition & 1 deletion pylint/lint/expand_modules.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

import os
import sys
from typing import Pattern
from re import Pattern

from astroid import modutils

Expand Down
3 changes: 2 additions & 1 deletion pylint/lint/parallel.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
import collections
import functools
import warnings
from typing import TYPE_CHECKING, Any, DefaultDict, Iterable, Sequence
from collections.abc import Iterable, Sequence
from typing import TYPE_CHECKING, Any, DefaultDict

import dill

Expand Down
3 changes: 2 additions & 1 deletion pylint/lint/pylinter.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@
import tokenize
import traceback
import warnings
from collections.abc import Iterable, Iterator, Sequence
from io import TextIOWrapper
from typing import Any, DefaultDict, Iterable, Iterator, Sequence
from typing import Any, DefaultDict

import astroid
from astroid import AstroidError, nodes
Expand Down
3 changes: 2 additions & 1 deletion pylint/message/message_definition_store.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@

import collections
import functools
from typing import TYPE_CHECKING, ValuesView
from collections.abc import ValuesView
from typing import TYPE_CHECKING

from pylint.exceptions import UnknownMessageError
from pylint.message.message_definition import MessageDefinition
Expand Down
5 changes: 4 additions & 1 deletion pylint/pyreverse/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,11 @@

create UML diagrams for classes and modules in <packages>
"""

from __future__ import annotations

import sys
from typing import Iterable
from collections.abc import Iterable
cdce8p marked this conversation as resolved.
Show resolved Hide resolved

from pylint.config import ConfigurationMixIn
from pylint.lint.utils import fix_import_path
Expand Down
3 changes: 2 additions & 1 deletion pylint/pyreverse/vcg_printer.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@

from __future__ import annotations

from typing import Any, Mapping
from collections.abc import Mapping
from typing import Any

from pylint.pyreverse.printer import EdgeType, Layout, NodeProperties, NodeType, Printer

Expand Down
3 changes: 2 additions & 1 deletion pylint/reporters/multi_reporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
from __future__ import annotations

import os
from typing import TYPE_CHECKING, Callable, TextIO
from collections.abc import Callable
from typing import TYPE_CHECKING, TextIO

from pylint.interfaces import IReporter
from pylint.message import Message
Expand Down
11 changes: 2 additions & 9 deletions pylint/reporters/reports_handler_mix_in.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,8 @@
from __future__ import annotations

import collections
from typing import (
TYPE_CHECKING,
Callable,
DefaultDict,
List,
MutableSequence,
Optional,
Tuple,
)
from collections.abc import MutableSequence
from typing import TYPE_CHECKING, Callable, DefaultDict, List, Optional, Tuple

from pylint.exceptions import EmptyReportError
from pylint.reporters.ureports.nodes import Section
Expand Down
3 changes: 2 additions & 1 deletion pylint/reporters/ureports/base_writer.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@
from __future__ import annotations

import sys
from collections.abc import Iterator
from io import StringIO
from typing import TYPE_CHECKING, Iterator, TextIO
from typing import TYPE_CHECKING, TextIO

if TYPE_CHECKING:
from pylint.reporters.ureports.nodes import (
Expand Down
3 changes: 2 additions & 1 deletion pylint/reporters/ureports/nodes.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@

from __future__ import annotations

from typing import Any, Callable, Iterable, Iterator, TypeVar
from collections.abc import Iterable, Iterator
from typing import Any, Callable, TypeVar

from pylint.reporters.ureports.base_writer import BaseWriter

Expand Down
2 changes: 1 addition & 1 deletion pylint/testutils/checker_test_case.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

import contextlib
import warnings
from typing import Generator
from collections.abc import Generator

from pylint.checkers.base_checker import BaseChecker
from pylint.constants import PY38_PLUS
Expand Down