Skip to content

Commit eb54f3c

Browse files
committed
Run slyp against the code base
This addresses several formatting issues, including: * Same-line str concatenation * Same-indentation-level multi-line str concatenation in function parameters and dict definitions * Unnecessary parentheses around str constants Although the initial work was automated, manual work was required to reflow multi-line concatenated strings to fit under the 100-character limit.
1 parent 3432318 commit eb54f3c

File tree

7 files changed

+280
-214
lines changed

7 files changed

+280
-214
lines changed

isort/main.py

Lines changed: 197 additions & 119 deletions
Large diffs are not rendered by default.

isort/output.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -338,7 +338,7 @@ def _with_from_imports(
338338
)
339339
if comment:
340340
single_import_line += (
341-
f"{(comments and ';') or config.comment_prefix} " f"{comment}"
341+
f"{(comments and ';') or config.comment_prefix} {comment}"
342342
)
343343
if from_import in as_imports:
344344
if (
@@ -467,7 +467,7 @@ def _with_from_imports(
467467
comment_prefix=config.comment_prefix,
468468
)
469469
single_import_line += (
470-
f"{(use_comments and ';') or config.comment_prefix} " f"{comment}"
470+
f"{(use_comments and ';') or config.comment_prefix} {comment}"
471471
)
472472
output.append(wrap.line(single_import_line, parsed.line_separator, config))
473473

@@ -486,7 +486,7 @@ def _with_from_imports(
486486
)
487487
import_statement = with_comments(
488488
comments,
489-
import_start + (", ").join(from_import_section),
489+
import_start + ", ".join(from_import_section),
490490
removed=config.ignore_comments,
491491
comment_prefix=config.comment_prefix,
492492
)

scripts/build_config_option_docs.py

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -109,17 +109,23 @@ def __str__(self):
109109
"length_sort_sections": "Sort the given sections by length",
110110
"forced_separate": "Force certain sub modules to show separately",
111111
"sections": "What sections isort should display imports for and in what order",
112-
"known_other": "known_OTHER is how imports of custom sections are defined. "
113-
"OTHER is a placeholder for the custom section name.",
114-
"comment_prefix": "Allows customizing how isort prefixes comments that it adds or modifies on import lines"
115-
"Generally ` #` (two spaces before a pound symbol) is use, though one space is also common.",
112+
"known_other": (
113+
"known_OTHER is how imports of custom sections are defined. "
114+
"OTHER is a placeholder for the custom section name."
115+
),
116+
"comment_prefix": (
117+
"Allows customizing how isort prefixes comments that it adds or modifies on import lines"
118+
"Generally ` #` (two spaces before a pound symbol) is use, though one space is also common."
119+
),
116120
"lines_before_imports": "The number of blank lines to place before imports. -1 for automatic determination",
117121
"lines_after_imports": "The number of blank lines to place after imports. -1 for automatic determination",
118122
"lines_between_sections": "The number of lines to place between sections",
119123
"lines_between_types": "The number of lines to place between direct and from imports",
120-
"lexicographical": "Lexicographical order is strictly alphabetical order. "
121-
"For example by default isort will sort `1, 10, 2` into `1, 2, 10` - but with "
122-
"lexicographical sorting enabled it will remain `1, 10, 2`.",
124+
"lexicographical": (
125+
"Lexicographical order is strictly alphabetical order. "
126+
"For example by default isort will sort `1, 10, 2` into `1, 2, 10` - but with "
127+
"lexicographical sorting enabled it will remain `1, 10, 2`."
128+
),
123129
"ignore_comments": "If enabled, isort will strip comments that exist within import lines.",
124130
"constants": "An override list of tokens to always recognize as a CONSTANT for order_by_type regardless of casing.",
125131
"classes": "An override list of tokens to always recognize as a Class for order_by_type regardless of casing.",

tests/integration/test_projects_using_isort.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,10 @@ def run_isort(arguments: Generator[str, None, None] | Sequence[str]):
2929

3030

3131
@pytest.mark.xfail(
32-
reason="Project is incorrectly formatted after PR #2236, should be fixed "
33-
"after a release and the project formatting again."
32+
reason=(
33+
"Project is incorrectly formatted after PR #2236, should be fixed "
34+
"after a release and the project formatting again."
35+
)
3436
)
3537
def test_django(tmpdir):
3638
git_clone("https://github.com/django/django.git", tmpdir)

0 commit comments

Comments
 (0)