summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPierre Sassoulas <pierre.sassoulas@gmail.com>2021-04-18 23:12:03 +0200
committerPierre Sassoulas <pierre.sassoulas@gmail.com>2021-04-19 22:05:11 +0200
commitc9a5fffd22e7e9aa5918679c891578d79ed242f0 (patch)
treecfcb8792fb00083607303bdbe24df256f569092c
parent53cb382d118faac3b937921b436a999e53a36480 (diff)
downloadastroid-git-c9a5fffd22e7e9aa5918679c891578d79ed242f0.tar.gz
Add isort to the pre-commit configuration
-rw-r--r--.pre-commit-config.yaml5
-rw-r--r--astroid/modutils.py8
-rw-r--r--doc/conf.py4
-rw-r--r--requirements_test_pre_commit.txt6
-rw-r--r--setup.py1
5 files changed, 20 insertions, 4 deletions
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index 521a8966..023474bf 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -10,6 +10,11 @@ repos:
- --expand-star-imports
- --remove-duplicate-keys
- --remove-unused-variables
+ - repo: https://github.com/PyCQA/isort
+ rev: 5.8.0
+ hooks:
+ - id: isort
+ exclude: tests/testdata|astroid/__init__.py
- repo: https://github.com/asottile/pyupgrade
rev: v2.12.0
hooks:
diff --git a/astroid/modutils.py b/astroid/modutils.py
index 181891d4..2f0827f0 100644
--- a/astroid/modutils.py
+++ b/astroid/modutils.py
@@ -33,17 +33,19 @@
:type BUILTIN_MODULES: dict
:var BUILTIN_MODULES: dictionary with builtin module names has key
"""
+
+# We don't want distutils to be a requirement
+# pylint: disable=import-error, no-name-in-module,useless-suppression
+
import importlib.util
import itertools
import os
import platform
import sys
-
-# pylint: disable=import-error, no-name-in-module
from distutils.errors import DistutilsPlatformError
from distutils.sysconfig import get_python_lib # pylint: disable=import-error
-from .interpreter._import import spec, util
+from astroid.interpreter._import import spec, util
# distutils is replaced by virtualenv with a module that does
# weird path manipulations in order to get to the
diff --git a/doc/conf.py b/doc/conf.py
index ee3300ce..bd94315b 100644
--- a/doc/conf.py
+++ b/doc/conf.py
@@ -10,7 +10,8 @@
# All configuration values have a default; values that are commented out
# serve to show the default.
-import sys, os
+import os
+import sys
from datetime import datetime
# If extensions (or modules to document with autodoc) are in another directory,
@@ -58,6 +59,7 @@ copyright = f'2003-{current_year}, Logilab, PyCQA and contributors'
#
# The short X.Y version.
from astroid.__pkginfo__ import version
+
# The full version, including alpha/beta/rc tags.
release = version
diff --git a/requirements_test_pre_commit.txt b/requirements_test_pre_commit.txt
new file mode 100644
index 00000000..5fa4ee80
--- /dev/null
+++ b/requirements_test_pre_commit.txt
@@ -0,0 +1,6 @@
+autoflake==1.4
+black==20.8b1
+pyupgrade==2.11.0
+black-disable-checker==1.0.0
+pylint
+isort=5.8.0
diff --git a/setup.py b/setup.py
index 004889a5..4a2f8d71 100644
--- a/setup.py
+++ b/setup.py
@@ -20,6 +20,7 @@
import os
import sys
import warnings
+
from setuptools import find_packages, setup
from setuptools.command import easy_install # pylint: disable=unused-import
from setuptools.command import install_lib # pylint: disable=unused-import