summaryrefslogtreecommitdiff
path: root/isort
Commit message (Collapse)AuthorAgeFilesLines
* Fix bug regarding multiline docstringsJon Banafato2021-03-221-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* Bump version to 5.8.05.8.0masterTimothy Crosley2021-03-202-1/+2
|
* Fix issue #1566: Fixed single location parsed line separator isn't usedissue/1566Timothy Crosley2021-03-201-1/+7
|
* Fixed #1594: incorrect placement of noqa comments with multiple from imports.Timothy Crosley2021-03-181-4/+8
|
* Resolved #1504: Added ability to push star imports to the top to avoid ↵Timothy Crosley2021-03-173-0/+17
| | | | overriding explicitly defined imports.
* Add support for reversing import sortTimothy Crosley2021-03-172-3/+9
|
* Add config option for reversing sort orderTimothy Crosley2021-03-162-0/+7
|
* Fix issue #1688: from statements removed when invalidTimothy Crosley2021-03-152-30/+45
|
* Resolve #1684: Add support for --extend-skip and --extend-skip-globTimothy Crosley2021-03-132-5/+43
|
* fixup! fixup! Clarify documentation for --skip optiongofr2021-03-111-1/+1
|
* fixup! Clarify documentation for --skip optiongofr2021-03-111-1/+1
|
* Clarify documentation for --skip optiongofr2021-03-111-1/+3
| | | | | | | | | | | | | | 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.
* Merge branch 'develop' into issue/1659/force-sort-sections-with-relative-importsTimothy Edmund Crosley2021-03-105-101/+143
|\
| * Merge combinabele if statements as recommended by deepsourceTimothy Crosley2021-03-051-21/+18
| |
| * Implemented #1638 / #1644: Provide a flag to ensure same file handle is ↵Timothy Crosley2021-03-043-1/+13
| | | | | | | | used after sorting.
| * Merge if statements per deepsourceTimothy Crosley2021-03-031-14/+14
| |
| * Don't add newlines if there are is no outputTimothy Crosley2021-03-031-37/+40
| |
| * Add test for allowing root, switch to allow root commandTimothy Crosley2021-03-011-7/+5
| |
| * Fix no / safetyTimothy Crosley2021-02-281-0/+14
| |
| * Fix errors found by deepsourceTimothy Crosley2021-02-271-4/+3
| |
| * Resolved issue #1669: Parallel now defaults to number of CPU cores if no ↵Timothy Crosley2021-02-261-1/+9
| | | | | | | | value is provided
| * fix :Failed to pull configuration information from pyproject.tomldongfangtianyu2021-02-241-1/+1
| |
| * Merge if statmentsMarco Lam2021-02-171-4/+5
| |
| * Fix not replacing the source file if only literals are changed but not the ↵Marco Lam2021-02-171-20/+30
| | | | | | | | imports
* | Add new option for sorting relative imports in force-sorted sectionsgofr2021-02-143-2/+20
| | | | | | | | | | | | | | | | 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.
* | Sort relative imports correctly with force_sort_within_sectionsgofr2021-02-111-4/+2
|/ | | | | | | | 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.
* Add wemake profileTimothy Crosley2021-02-091-0/+7
|
* Made identified imports .statement() runnable codeissue/1641Timothy Crosley2021-02-071-4/+6
|
* Fix coding error found by deepsourceTimothy Crosley2021-02-061-4/+8
|
* Merge pull request #1653 from gofr/issue/1634/vert-grid-trailing-chars-2Timothy Edmund Crosley2021-02-063-10/+13
|\ | | | | Issue/1634/vert grid trailing chars 2
| * squash! fixup! Respect line_length in vertical grid modes and deprecate mode 6gofr2021-02-051-1/+2
| | | | | | | | Linting work-around
| * fixup! Respect line_length in vertical grid modes and deprecate mode 6gofr2021-02-051-2/+2
| |
| * Respect line_length in vertical grid modes and deprecate mode 6gofr2021-02-053-10/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | Don't print skipped/broken files with quiet config settinggofr2021-02-051-2/+2
|/ | | | | | | | 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.
* Indicate type hint support with a py.typed filePavel Savchenko2021-02-031-0/+0
| | | | fix #1648
* Clarify it effects straight imports onlyTimothy Crosley2021-01-121-2/+4
|
* Update output to respect as import comment locationTimothy Crosley2021-01-121-5/+5
|
* Update output to take into account difference between as and non as import ↵Timothy Crosley2021-01-111-3/+8
| | | | statements
* Simplify section_key helper function argumentsgofr2021-01-022-32/+12
| | | | | | 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.
* Merge pull request #1626 from gofr/issue/1624Timothy Edmund Crosley2021-01-014-1/+29
|\ | | | | Make force_sort_within_sections respect case
| * Move fix behind a flaggofr2020-12-314-1/+18
| |
| * Make force_sort_within_sections respect casegofr2020-12-302-2/+13
| | | | | | | | | | | | | | | | | | | | | | 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.
* | Regenerate config option docsTimothy Crosley2020-12-302-8/+0
| |
* | Bump to version 5.7.0Timothy Crosley2020-12-301-1/+1
| |
* | 100% test coverage for new identify moduleTimothy Crosley2020-12-301-8/+10
| |
* | Fix indented identification isortTimothy Crosley2020-12-301-14/+16
| |
* | Expose ImportKey from main isort importTimothy Crosley2020-12-301-0/+1
| |
* | Fix handling of yield and raise statements in import identificationTimothy Crosley2020-12-301-0/+19
| |
* | Undo skip gitignore for black profileTimothy Crosley2020-12-301-1/+0
| |
* | Config path should never be auto determined for import identification CLITimothy Crosley2020-12-301-2/+2
|/