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

Updates round 2 #2329

Merged
merged 8 commits into from
Jan 14, 2025
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
3 changes: 2 additions & 1 deletion .flake8
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
[flake8]
max-line-length = 100
# Ignore non PEP 8 compliant rules as suggested by black
# E203: https://github.com/psf/black/blob/3fab5ade71bccf80ae0a5af76729099869adea56/docs/the_black_code_style/current_style.md#slices
extend-ignore =
E203, # https://github.com/psf/black/blob/master/docs/the_black_code_style.md#slices
E203,
E501,
B017
exclude = _vendored
Expand Down
2 changes: 1 addition & 1 deletion isort/literal.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def assignment(code: str, sort_type: str, extension: str, config: Config = DEFAU
raise LiteralParsingFailure(code, error)

expected_type, sort_function = type_mapping[sort_type]
if type(value) != expected_type:
if type(value) is not expected_type:
raise LiteralSortTypeMismatch(type(value), expected_type)

printer = ISortPrettyPrinter(config)
Expand Down
126 changes: 58 additions & 68 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ pipreqs = ">=0.4.9"
pip_api = ">=0.0.12"
pylama = ">=7.7"
pip = ">=21.1.1"
py = ">=1.11.0"
safety = ">=2.2.0"
libcst = ">=0.3.18"
mypy-extensions = ">=0.4.3"
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/test_hypothesmith.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def _record_targets(code: str, prefix: str = "") -> str:
return code


def configs(**force_strategies: st.SearchStrategy[isort.Config]) -> st.SearchStrategy[isort.Config]:
def configs(**force_strategies: st.SearchStrategy) -> st.SearchStrategy:
"""Generate arbitrary Config objects."""
skip = {
"line_ending",
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/test_setting_combinations.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def _as_config(kw) -> isort.Config:
return isort.Config(**kw)


def configs() -> st.SearchStrategy[isort.Config]:
def configs() -> st.SearchStrategy:
"""Generate arbitrary Config objects."""
skip = {
"line_ending",
Expand Down
17 changes: 9 additions & 8 deletions tests/unit/test_isort.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,8 @@
from io import StringIO
from pathlib import Path
from tempfile import NamedTemporaryFile
from typing import TYPE_CHECKING, Any, Dict, Iterator, List, Set, Tuple
from typing import TYPE_CHECKING, Any, Iterator, List, Set, Tuple

import py
import pytest

import isort
Expand All @@ -24,6 +23,8 @@
from .utils import UnreadableStream, as_stream

if TYPE_CHECKING:
from typing import Dict # noqa: F401

WrapModes: Any
else:
from isort.wrap_modes import WrapModes
Expand Down Expand Up @@ -1630,13 +1631,13 @@ def test_multiline_import() -> None:
assert isort.code(test_input) == ("from pkg import more_stuff, other_suff, stuff\n")

# test again with a custom configuration
custom_configuration = {
custom_configuration: dict[str, Any] = {
"force_single_line": True,
"line_length": 120,
"known_first_party": ["asdf", "qwer"],
"default_section": "THIRDPARTY",
"forced_separate": "asdf",
} # type: Dict[str, Any]
}
expected_output = (
"from pkg import more_stuff\n" "from pkg import other_suff\n" "from pkg import stuff\n"
)
Expand Down Expand Up @@ -4259,12 +4260,12 @@ def test_noqa_issue_679() -> None:
assert isort.code(test_input.lower(), honor_noqa=True) == test_output_honor_noqa.lower()


def test_extract_multiline_output_wrap_setting_from_a_config_file(tmpdir: py.path.local) -> None:
def test_extract_multiline_output_wrap_setting_from_a_config_file(tmp_path: Path) -> None:
editorconfig_contents = ["root = true", " [*.py]", "multi_line_output = 5"]
config_file = tmpdir.join(".editorconfig")
config_file.write("\n".join(editorconfig_contents))
config_file = tmp_path / ".editorconfig"
config_file.write_text("\n".join(editorconfig_contents))

config = Config(settings_path=str(tmpdir))
config = Config(settings_path=str(tmp_path))
assert config.multi_line_output == WrapModes.VERTICAL_GRID_GROUPED


Expand Down
Loading
Loading