| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
If a multiline docstring has its closing quotes at the end of a line
instead of on a separate line, isort fails to properly add imports using
the `add_imports` config option; instead, it adds the desired imports
into the middle of the docstring as illustrated below. While PEP 257
(and other guides) advises that closing quotes appear on their own line,
`isort` should not fail here.
This change adds a check for closing docstrings at the end of a line in
addition to the existing line start check for all comment indicators. A
new section of the `test_add_imports` test explicitly tests multiline
imports and this failure scenario specifically.
---
A working example:
```python
"""My module.
Provides example functionality.
"""
print("hello, world")
```
Running `isort --add-import "from __future__ import annotations"`
produces the following as expected:
```python
"""My module.
Provides example functionality.
"""
from __future__ import annotations
print("hello, world")
```
---
The failure behavior described:
```python
"""My module.
Provides example functionality."""
print("hello, world")
```
Running `isort --add-import "from __future__ import annotations"` as
above produces the following result:
```python
"""My module.
from __future__ import annotations
Provides example functionality."""
print("hello, world")
```
Subsequent executions add more import lines into the docstring. This
behavior occurs even if the file already has the desired imports.
|
| | |
|
| | |
|
| | |
|
| |
|
|
| |
overriding explicitly defined imports.
|
| | |
|
| | |
|
| | |
|
| | |
|
| | |
|
| | |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
The --skip option only handles full file paths or names of
individual path components.
For example, "foo/bar/baz.py" can be used to skip just that file.
And "foo" would skip any files with that name and any files nested
in directories with that name.
On the other hand, "foo/bar" does *not* skip everything in the
"foo/bar" directory. --skip-glob can be used to achieve this.
Attempt to clarify the documentation to say that.
|
| |\ |
|
| | | |
|
| | |
| |
| |
| | |
used after sorting.
|
| | | |
|
| | | |
|
| | | |
|
| | | |
|
| | | |
|
| | |
| |
| |
| | |
value is provided
|
| | | |
|
| | | |
|
| | |
| |
| |
| | |
imports
|
| | |
| |
| |
| |
| |
| |
| |
| | |
Add --sort-relative-in-force-sorted-sections to make sorting of
--force-sort-within-sections consistent with the way imports are
sorted without force-sorted sections.
Add tests for both the old and new behaviors.
|
| |/
|
|
|
|
|
|
| |
Relative import sort order when using force_sort_within_sections
was inconsistent with the order without that setting. Change the
force_sort_within_sections sort order to match.
This fixes the relative import ordering issues noted in #1659.
|
| | |
|
| | |
|
| | |
|
| |\
| |
| | |
Issue/1634/vert grid trailing chars 2
|
| | |
| |
| |
| | |
Linting work-around
|
| | | |
|
| | |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
In the three vertical grid multi line modes (4, 5 and 6), each
mode had a bug where the line length would be overcounted or
undercounted by one character when used in combination with an
unexpected value for the include_trailing_comma setting.
This could cause import lines to exceed the line_length or be
wrapped at one less than the specified line_length.
Count the trailing characters correctly.
This also deprecates mode 6, since the only difference between
this mode and mode 5 is in how it handles include_trailing_comma.
The distinction is no longer relevant, since mode 5 can now handle
both possible values of include_trailing_comma.
For backwards compatibility, make mode 6 an alias for mode 5.
|
| |/
|
|
|
|
|
|
| |
When using --quiet, no warnings are printed about skipped and
broken paths. But you do get warnings when using the "quiet"
setting in a config file.
Be consistent and don't print the warnings then either.
|
| |
|
|
| |
fix #1648
|
| | |
|
| | |
|
| |
|
|
| |
statements
|
| |
|
|
|
|
| |
sorting.section_key() is only used once and all its arguments
come from Config. Make it take a single config parameter instead
of a bunch of individual settings.
|
| |\
| |
| | |
Make force_sort_within_sections respect case
|
| | | |
|
| | |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
force_sort_within_sections only looked at the order_by_type
option to determine how to order imports with different case
in a section. Whether you order import names by type or not
also affected the order of the modules.
When force_sort_within_sections is used:
* ignore case on the module name if case_sensitive is false,
* ignore case on the imported names if order_by_type is false.
|
| | | |
|
| | | |
|
| | | |
|
| | | |
|
| | | |
|
| | | |
|
| | | |
|
| |/ |
|