Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:mcalabkova:branches:devel:languages:python
python-isort
black-trailing-comma.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File black-trailing-comma.patch of Package python-isort
From ce5b0dc91ae4efc7aeacf9e688a829cba6d8cd4e Mon Sep 17 00:00:00 2001 From: Blazej Michalik <blazej.michalik@nokia.com> Date: Fri, 16 Feb 2024 12:26:04 +0100 Subject: [PATCH] Black profile: enable magic comma --- docs/configuration/profiles.md | 1 + isort/profiles.py | 1 + tests/unit/profiles/test_black.py | 13 +++++++++++++ 3 files changed, 15 insertions(+) diff --git a/docs/configuration/profiles.md b/docs/configuration/profiles.md index a8e09dd25..c7b53062d 100644 --- a/docs/configuration/profiles.md +++ b/docs/configuration/profiles.md @@ -12,6 +12,7 @@ To use any of the listed profiles, use `isort --profile PROFILE_NAME` from the c - **multi_line_output**: `3` - **include_trailing_comma**: `True` + - **split_on_trailing_comma**: `True` - **force_grid_wrap**: `0` - **use_parentheses**: `True` - **ensure_newline_before_comments**: `True` diff --git a/isort/profiles.py b/isort/profiles.py index fe2aac492..06847ffe3 100644 --- a/isort/profiles.py +++ b/isort/profiles.py @@ -4,6 +4,7 @@ black = { "multi_line_output": 3, "include_trailing_comma": True, + "split_on_trailing_comma": True, "force_grid_wrap": 0, "use_parentheses": True, "ensure_newline_before_comments": True, diff --git a/tests/unit/profiles/test_black.py b/tests/unit/profiles/test_black.py index bd1835a60..4d01561b4 100644 --- a/tests/unit/profiles/test_black.py +++ b/tests/unit/profiles/test_black.py @@ -447,3 +447,16 @@ def sub(a: np.ndarray, b: np.ndarray) -> np.ndarray: ... lines_before_imports=2, # will be ignored lines_after_imports=2, # will be ignored ) + + +def test_black_trailing_comma(): + black_test( + "from x import (a, b, c,)\n", + """\ +from x import ( + a, + b, + c, +) +""", + )
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor