Skip to content

Commit

Permalink
Simplify isort configuration using 'profile = black' (#1204)
Browse files Browse the repository at this point in the history
isort now has builtin support for black, use it.
  • Loading branch information
jdufresne authored Aug 19, 2020
1 parent 55f1d87 commit e8af4f4
Show file tree
Hide file tree
Showing 9 changed files with 17 additions and 24 deletions.
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ repos:
hooks:
- id: black
language_version: python3
- repo: https://github.com/pre-commit/mirrors-isort
rev: v4.3.21
- repo: https://github.com/timothycrosley/isort
rev: 5.4.2
hooks:
- id: isort
language_version: python3
Expand Down
4 changes: 2 additions & 2 deletions piptools/repositories/local.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@

from pip._internal.utils.hashes import FAVORITE_HASH

from .base import BaseRepository

from piptools.utils import as_tuple, key_from_ireq, make_install_requirement

from .base import BaseRepository


def ireq_satisfied_by_existing_pin(ireq, existing_pin):
"""
Expand Down
8 changes: 1 addition & 7 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,4 @@ pytest-parametrize-values-type = tuple
pytest-parametrize-values-row-type = tuple

[isort]
combine_as_imports = True
forced_separate = piptools
include_trailing_comma = True
line_length = 88
multi_line_output = 3
default_section=THIRDPARTY
known_first_party = piptools, tests, examples
profile = black
6 changes: 3 additions & 3 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,6 @@
from pip._vendor.packaging.version import Version
from pip._vendor.pkg_resources import Requirement

from .constants import MINIMAL_WHEELS_PATH
from .utils import looks_like_ci

from piptools.cache import DependencyCache
from piptools.exceptions import NoCandidateFound
from piptools.repositories import PyPIRepository
Expand All @@ -32,6 +29,9 @@
make_install_requirement,
)

from .constants import MINIMAL_WHEELS_PATH
from .utils import looks_like_ci


class FakeRepository(BaseRepository):
def __init__(self):
Expand Down
4 changes: 2 additions & 2 deletions tests/test_cli_compile.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@
import pytest
from pip._internal.utils.urls import path_to_url

from piptools.scripts.compile import cli

from .constants import MINIMAL_WHEELS_PATH, PACKAGES_PATH
from .utils import invoke

from piptools.scripts.compile import cli


@pytest.fixture(autouse=True)
def _temp_dep_cache(tmpdir, monkeypatch):
Expand Down
4 changes: 2 additions & 2 deletions tests/test_cli_sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
import mock
import pytest

from .utils import invoke

from piptools.scripts.sync import DEFAULT_REQUIREMENTS_FILE, cli

from .utils import invoke


def test_run_as_module_sync():
"""piptools can be run as ``python -m piptools ...``."""
Expand Down
3 changes: 1 addition & 2 deletions tests/test_repository_local.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,9 @@

import pytest

from tests.conftest import FakeRepository

from piptools.repositories.local import LocalRequirementsRepository
from piptools.utils import name_from_req
from tests.conftest import FakeRepository

EXPECTED = {"sha256:5e6071ee6e4c59e0d0408d366fe9b66781d2cf01be9a6e19a2433bb3c5336330"}

Expand Down
4 changes: 2 additions & 2 deletions tests/test_sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@
import pytest
from pip._internal.utils.urls import path_to_url

from .constants import PACKAGES_PATH

from piptools.exceptions import IncompatibleRequirements
from piptools.sync import dependency_tree, diff, merge, sync

from .constants import PACKAGES_PATH


@pytest.fixture
def mocked_tmp_file():
Expand Down
4 changes: 2 additions & 2 deletions tests/test_top_level_editable.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

import pytest

from .constants import PACKAGES_PATH

from piptools.repositories import PyPIRepository

from .constants import PACKAGES_PATH


class MockedPyPIRepository(PyPIRepository):
def get_dependencies(self, ireq):
Expand Down

0 comments on commit e8af4f4

Please sign in to comment.