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

Run slyp against the code base #2382

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
316 changes: 197 additions & 119 deletions isort/main.py

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions isort/output.py
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,7 @@ def _with_from_imports(
)
if comment:
single_import_line += (
f"{(comments and ';') or config.comment_prefix} " f"{comment}"
f"{(comments and ';') or config.comment_prefix} {comment}"
)
if from_import in as_imports:
if (
Expand Down Expand Up @@ -467,7 +467,7 @@ def _with_from_imports(
comment_prefix=config.comment_prefix,
)
single_import_line += (
f"{(use_comments and ';') or config.comment_prefix} " f"{comment}"
f"{(use_comments and ';') or config.comment_prefix} {comment}"
)
output.append(wrap.line(single_import_line, parsed.line_separator, config))

Expand All @@ -486,7 +486,7 @@ def _with_from_imports(
)
import_statement = with_comments(
comments,
import_start + (", ").join(from_import_section),
import_start + ", ".join(from_import_section),
removed=config.ignore_comments,
comment_prefix=config.comment_prefix,
)
Expand Down
20 changes: 13 additions & 7 deletions scripts/build_config_option_docs.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,17 +109,23 @@ def __str__(self):
"length_sort_sections": "Sort the given sections by length",
"forced_separate": "Force certain sub modules to show separately",
"sections": "What sections isort should display imports for and in what order",
"known_other": "known_OTHER is how imports of custom sections are defined. "
"OTHER is a placeholder for the custom section name.",
"comment_prefix": "Allows customizing how isort prefixes comments that it adds or modifies on import lines"
"Generally ` #` (two spaces before a pound symbol) is use, though one space is also common.",
"known_other": (
"known_OTHER is how imports of custom sections are defined. "
"OTHER is a placeholder for the custom section name."
),
"comment_prefix": (
"Allows customizing how isort prefixes comments that it adds or modifies on import lines"
"Generally ` #` (two spaces before a pound symbol) is use, though one space is also common."
),
"lines_before_imports": "The number of blank lines to place before imports. -1 for automatic determination",
"lines_after_imports": "The number of blank lines to place after imports. -1 for automatic determination",
"lines_between_sections": "The number of lines to place between sections",
"lines_between_types": "The number of lines to place between direct and from imports",
"lexicographical": "Lexicographical order is strictly alphabetical order. "
"For example by default isort will sort `1, 10, 2` into `1, 2, 10` - but with "
"lexicographical sorting enabled it will remain `1, 10, 2`.",
"lexicographical": (
"Lexicographical order is strictly alphabetical order. "
"For example by default isort will sort `1, 10, 2` into `1, 2, 10` - but with "
"lexicographical sorting enabled it will remain `1, 10, 2`."
),
"ignore_comments": "If enabled, isort will strip comments that exist within import lines.",
"constants": "An override list of tokens to always recognize as a CONSTANT for order_by_type regardless of casing.",
"classes": "An override list of tokens to always recognize as a Class for order_by_type regardless of casing.",
Expand Down
6 changes: 4 additions & 2 deletions tests/integration/test_projects_using_isort.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,10 @@ def run_isort(arguments: Generator[str, None, None] | Sequence[str]):


@pytest.mark.xfail(
reason="Project is incorrectly formatted after PR #2236, should be fixed "
"after a release and the project formatting again."
reason=(
"Project is incorrectly formatted after PR #2236, should be fixed "
"after a release and the project formatting again."
)
)
def test_django(tmpdir):
git_clone("https://github.com/django/django.git", tmpdir)
Expand Down
Loading