Skip to content

Commit 89f1a6f

Browse files
dbatyPierre-Sassoulas
authored andcommitted
Switch to isort 5 for pylint's own code
1 parent 9bc9bdf commit 89f1a6f

22 files changed

+23
-33
lines changed

.isort.cfg

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@ line_length=88
44
known_third_party=astroid, sphinx, isort, pytest, mccabe, six, toml
55
include_trailing_comma=True
66
skip_glob=tests/functional/**,tests/input/**,tests/extensions/data/**,tests/regrtest_data/**,tests/data/**,astroid/**,venv/**
7-
project=pylint
7+
src_paths=pylint

pylint/checkers/base.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@
5454
# For details: https://github.com/PyCQA/pylint/blob/master/COPYING
5555

5656
"""basic checker for Python code"""
57-
5857
import builtins
5958
import collections
6059
import itertools
@@ -67,8 +66,8 @@
6766
import astroid.scoped_nodes
6867
from astroid.arguments import CallSite
6968

70-
import pylint.utils as lint_utils
7169
from pylint import checkers, exceptions, interfaces
70+
from pylint import utils as lint_utils
7271
from pylint.checkers import utils
7372
from pylint.checkers.utils import (
7473
is_overload_stub,

pylint/checkers/spelling.py

+2-3
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121

2222
"""Checker for spelling errors in comments and docstrings.
2323
"""
24-
2524
import os
2625
import re
2726
import tokenize
@@ -33,12 +32,12 @@
3332
try:
3433
import enchant
3534
from enchant.tokenize import ( # type: ignore
36-
get_tokenizer,
3735
Chunker,
38-
Filter,
3936
EmailFilter,
37+
Filter,
4038
URLFilter,
4139
WikiWordFilter,
40+
get_tokenizer,
4241
)
4342
except ImportError:
4443
enchant = None

pylint/checkers/utils.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -50,13 +50,12 @@
5050
from functools import lru_cache, partial
5151
from typing import Callable, Dict, Iterable, List, Match, Optional, Set, Tuple, Union
5252

53+
import _string
5354
import astroid
5455
from astroid import bases as _bases
5556
from astroid import helpers, scoped_nodes
5657
from astroid.exceptions import _NonDeducibleTypeHierarchy
5758

58-
import _string # pylint: disable=wrong-import-position, wrong-import-order
59-
6059
BUILTINS_NAME = builtins.__name__
6160
COMP_NODE_TYPES = (
6261
astroid.ListComp,

pylint/epylint.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,10 @@
5656
its output.
5757
"""
5858
import os
59-
import os.path as osp
6059
import shlex
6160
import sys
6261
from io import StringIO
62+
from os import path as osp
6363
from subprocess import PIPE, Popen
6464

6565

pylint/extensions/docparams.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@
2121
"""
2222
import astroid
2323

24-
import pylint.extensions._check_docs_utils as utils
2524
from pylint.checkers import BaseChecker
2625
from pylint.checkers import utils as checker_utils
26+
from pylint.extensions import _check_docs_utils as utils
2727
from pylint.interfaces import IAstroidChecker
2828

2929

pylint/graph.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,12 @@
1313
1414
(dot generation adapted from pypy/translator/tool/make_dot.py)
1515
"""
16-
1716
import codecs
1817
import os
19-
import os.path as osp
2018
import subprocess
2119
import sys
2220
import tempfile
21+
from os import path as osp
2322

2423

2524
def target_info_from_filename(filename):

setup.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@
3939

4040
USE_SETUPTOOLS = 1
4141
except ImportError:
42-
from distutils.core import setup
4342
from distutils.command import install_lib # pylint: disable=unused-import
43+
from distutils.core import setup
4444

4545
USE_SETUPTOOLS = 0
4646
easy_install_lib = None

tests/checkers/unittest_typecheck.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
from pylint.testutils import CheckerTestCase, Message, set_config
2727

2828
try:
29-
import coverage.tracer as _
29+
from coverage import tracer as _ # pylint: disable=unused-import
3030

3131
C_EXTENTIONS_AVAILABLE = True
3232
except ImportError:

tests/extensions/test_bad_builtin.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,7 @@
88

99
"""Tests for the pylint checker in :mod:`pylint.extensions.bad_builtin
1010
"""
11-
12-
import os.path as osp
11+
from os import path as osp
1312

1413
import pytest
1514

tests/extensions/test_broad_try_clause.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,8 @@
88
# For details: https://github.com/PyCQA/pylint/blob/master/COPYING
99

1010
"""Tests for the pylint checker in :mod:`pylint.extensions.broad_try_clause`"""
11-
12-
import os.path as osp
1311
import unittest
12+
from os import path as osp
1413

1514
from pylint import checkers
1615
from pylint.extensions.broad_try_clause import BroadTryClauseChecker

tests/extensions/test_check_docs_utils.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
import astroid
1515
import pytest
1616

17-
import pylint.extensions._check_docs_utils as utils
17+
from pylint.extensions import _check_docs_utils as utils
1818

1919

2020
@pytest.mark.parametrize(

tests/extensions/test_check_mccabe.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"""Tests for the pylint checker in :mod:`pylint.extensions.check_mccabe"""
1111
# pylint: disable=redefined-outer-name
1212

13-
import os.path as osp
13+
from os import path as osp
1414

1515
import pytest
1616

tests/extensions/test_elseif_used.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,7 @@
99

1010
"""Tests for the pylint checker in :mod:`pylint.extensions.check_elif
1111
"""
12-
13-
import os.path as osp
12+
from os import path as osp
1413

1514
import pytest
1615

tests/extensions/test_emptystring.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,7 @@
1212

1313
"""Tests for the pylint checker in :mod:`pylint.extensions.emptystring
1414
"""
15-
16-
import os.path as osp
15+
from os import path as osp
1716

1817
import pytest
1918

tests/extensions/test_redefined.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,7 @@
77
# For details: https://github.com/PyCQA/pylint/blob/master/COPYING
88

99
"""Tests for the pylint checker in :mod:`pylint.extensions.check_elif"""
10-
11-
import os.path as osp
10+
from os import path as osp
1211

1312
import pytest
1413

tests/lint/unittest_lint.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,7 @@
4747

4848
import pytest
4949

50-
import pylint.testutils as testutils
51-
from pylint import checkers, config, exceptions, interfaces, lint
50+
from pylint import checkers, config, exceptions, interfaces, lint, testutils
5251
from pylint.checkers.utils import check_messages
5352
from pylint.constants import (
5453
MSG_STATE_CONFIDENCE,

tests/test_import_graph.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818

1919
import pytest
2020

21-
import pylint.testutils as testutils
21+
from pylint import testutils
2222
from pylint.checkers import imports, initialize
2323
from pylint.lint import PyLinter
2424

tests/test_regr.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
import astroid
2525
import pytest
2626

27-
import pylint.testutils as testutils
27+
from pylint import testutils
2828

2929
REGR_DATA = join(dirname(abspath(__file__)), "regrtest_data")
3030
sys.path.insert(1, REGR_DATA)

tests/unittest_pyreverse_diadefs.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919

2020
import astroid
2121
import pytest
22+
from unittest_pyreverse_writer import Config, get_project
2223

2324
from pylint.pyreverse.diadefslib import (
2425
ClassDiadefGenerator,
@@ -27,7 +28,6 @@
2728
DiadefsHandler,
2829
)
2930
from pylint.pyreverse.inspector import Linker
30-
from unittest_pyreverse_writer import Config, get_project
3131

3232

3333
def _process_classes(classes):

tests/unittest_pyreverse_inspector.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@
1616
import astroid
1717
import pytest
1818
from astroid import bases, nodes
19+
from unittest_pyreverse_writer import get_project
1920

2021
from pylint.pyreverse import inspector
21-
from unittest_pyreverse_writer import get_project
2222

2323

2424
@pytest.fixture

tox.ini

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ deps =
4040
isort==5.4.2
4141
commands =
4242
black --check . --exclude="tests/functional/|tests/input|tests/extensions/data|tests/regrtest_data/|tests/data/|venv|astroid|.tox"
43-
isort -rc . --check-only
43+
isort . --check-only
4444
changedir = {toxinidir}
4545

4646
[testenv:mypy]

0 commit comments

Comments
 (0)