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

--add-imports --append-only appends in middle of class #1838

Closed
asottile opened this issue Nov 2, 2021 · 0 comments
Closed

--add-imports --append-only appends in middle of class #1838

asottile opened this issue Nov 2, 2021 · 0 comments

Comments

@asottile
Copy link
Member

asottile commented Nov 2, 2021

small example:

class C:
    """a

    """
    # comment
isort --append-only --add-import 'from __future__ import annotations' t.py
class C:
    """a

    """
from __future__ import annotations

    # comment

I'm using isort 5.9.3

bors bot added a commit to ChrisRBe/PP-P2P-Parser that referenced this issue Nov 3, 2021
430: build(deps): bump isort from 5.9.3 to 5.10.0 r=ChrisRBe a=dependabot[bot]

Bumps [isort](https://github.com/pycqa/isort) from 5.9.3 to 5.10.0.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a href="https://github.com/pycqa/isort/releases">isort's releases</a>.</em></p>
<blockquote>
<h2>5.10.0</h2>
<pre><code>Implemented [#1796](PyCQA/isort#1796): Switch to tomli for pyproject.toml configuration loader.
Fixed [#1801](PyCQA/isort#1801): CLI bug (--exend-skip-glob, overrides instead of extending).
Fixed [#1802](PyCQA/isort#1802): respect PATH customization in nested calls to git.
Fixed [#1838](PyCQA/isort#1838): Append only with certain code snippets incorrectly adds imports.
Added official support for Python 3.10
</code></pre>
</blockquote>
</details>
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a href="https://github.com/PyCQA/isort/blob/main/CHANGELOG.md">isort's changelog</a>.</em></p>
<blockquote>
<h3>5.10.0 November 3 2021</h3>
<ul>
<li>Implemented <a href="https://github-redirect.dependabot.com/pycqa/isort/issues/1796">#1796</a>: Switch to <code>tomli</code> for pyproject.toml configuration loader.</li>
<li>Fixed <a href="https://github-redirect.dependabot.com/pycqa/isort/issues/1801">#1801</a>: CLI bug (--exend-skip-glob, overrides instead of extending).</li>
<li>Fixed <a href="https://github-redirect.dependabot.com/pycqa/isort/issues/1802">#1802</a>: respect PATH customization in nested calls to git.</li>
<li>Fixed <a href="https://github-redirect.dependabot.com/pycqa/isort/issues/1838">#1838</a>: Append only with certain code snippets incorrectly adds imports.</li>
<li>Added official support for Python 3.10</li>
</ul>
<h4>Potentially breaking changes:</h4>
<ul>
<li>Fixed <a href="https://github-redirect.dependabot.com/pycqa/isort/issues/1785">#1785</a>: <code>_ast</code> module incorrectly excluded from stdlib definition.</li>
</ul>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a href="https://github.com/PyCQA/isort/commit/c154ecff496bf9309eaf5d887f4aa4a0abba28a2"><code>c154ecf</code></a> Bump version to 5.10.0</li>
<li><a href="https://github.com/PyCQA/isort/commit/7a13f31eab7bcb692b1f5b537b124464018c1889"><code>7a13f31</code></a> Add changelog for 5.10</li>
<li><a href="https://github.com/PyCQA/isort/commit/73245e942de97fe1a4a2d968bbde3c168a97e64c"><code>73245e9</code></a> Fixes <a href="https://github-redirect.dependabot.com/pycqa/isort/issues/1838">#1838</a>: don't append imports where no imports are present</li>
<li><a href="https://github.com/PyCQA/isort/commit/223dc4cdf41e5557f28498b050a5ef1c02fef50c"><code>223dc4c</code></a> Remove unused import</li>
<li><a href="https://github.com/PyCQA/isort/commit/488cdcac10d4775d9ac2b63401a9a024a43705cf"><code>488cdca</code></a> Fix formatting</li>
<li><a href="https://github.com/PyCQA/isort/commit/1f093f691038e35303eb326e5a82b7cfcd918753"><code>1f093f6</code></a> Merge pull request <a href="https://github-redirect.dependabot.com/pycqa/isort/issues/1833">#1833</a> from chrisdecker1201/bug/do_not_skip_string</li>
<li><a href="https://github.com/PyCQA/isort/commit/3c5da48559a4052b47f170c1a3fe3cdd5bd928da"><code>3c5da48</code></a> use regex to mach file_skip</li>
<li><a href="https://github.com/PyCQA/isort/commit/4e3f64bf91b50c9d2923c60853e0701ab04f388f"><code>4e3f64b</code></a> fix linter</li>
<li><a href="https://github.com/PyCQA/isort/commit/ba81f1c933a11e3391af3ad89d6cf2b38dcdf4ee"><code>ba81f1c</code></a> Merge pull request <a href="https://github-redirect.dependabot.com/pycqa/isort/issues/1834">#1834</a> from pzelnip/patch-1</li>
<li><a href="https://github.com/PyCQA/isort/commit/b1c5d7b2768f6c575929a6d9d1c7c6731454f670"><code>b1c5d7b</code></a> Minor improvements to pre-commit.md</li>
<li>Additional commits viewable in <a href="https://github.com/pycqa/isort/compare/5.9.3...5.10.0">compare view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=isort&package-manager=pip&previous-version=5.9.3&new-version=5.10.0)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting ``@dependabot` rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- ``@dependabot` rebase` will rebase this PR
- ``@dependabot` recreate` will recreate this PR, overwriting any edits that have been made to it
- ``@dependabot` merge` will merge this PR after your CI passes on it
- ``@dependabot` squash and merge` will squash and merge this PR after your CI passes on it
- ``@dependabot` cancel merge` will cancel a previously requested merge and block automerging
- ``@dependabot` reopen` will reopen this PR if it is closed
- ``@dependabot` close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
- ``@dependabot` ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
- ``@dependabot` ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
- ``@dependabot` ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)


</details>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
mergify bot pushed a commit to aws-powertools/powertools-lambda-python that referenced this issue Nov 17, 2021
[//]: # (dependabot-start)
⚠️  **Dependabot is rebasing this PR** ⚠️ 

Rebasing might not happen immediately, so don't worry if this takes some time.

Note: if you make any changes to this PR yourself, they will take precedence over the rebase.

---

[//]: # (dependabot-end)

Bumps [isort](https://github.com/pycqa/isort) from 5.9.3 to 5.10.1.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a href="https://github.com/pycqa/isort/releases">isort's releases</a>.</em></p>
<blockquote>
<h3>5.10.1 November 8 2021</h3>
<ul>
<li>Fixed <a href="https://github-redirect.dependabot.com/pycqa/isort/issues/1819">#1819</a>: Occasional inconsistency with multiple src paths.</li>
<li>Fixed <a href="https://github-redirect.dependabot.com/pycqa/isort/issues/1840">#1840</a>: skip_file ignored when on the first docstring line</li>
</ul>
<h2>5.10.0</h2>
<pre><code>Implemented [#1796](PyCQA/isort#1796): Switch to tomli for pyproject.toml configuration loader.
Fixed [#1801](PyCQA/isort#1801): CLI bug (--exend-skip-glob, overrides instead of extending).
Fixed [#1802](PyCQA/isort#1802): respect PATH customization in nested calls to git.
Fixed [#1838](PyCQA/isort#1838): Append only with certain code snippets incorrectly adds imports.
Added official support for Python 3.10
</code></pre>
</blockquote>
</details>
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a href="https://github.com/PyCQA/isort/blob/main/CHANGELOG.md">isort's changelog</a>.</em></p>
<blockquote>
<h3>5.10.1 November 8 2021</h3>
<ul>
<li>Fixed <a href="https://github-redirect.dependabot.com/pycqa/isort/issues/1819">#1819</a>: Occasional inconsistency with multiple src paths.</li>
<li>Fixed <a href="https://github-redirect.dependabot.com/pycqa/isort/issues/1840">#1840</a>: skip_file ignored when on the first docstring line</li>
</ul>
<h3>5.10.0 November 3 2021</h3>
<ul>
<li>Implemented <a href="https://github-redirect.dependabot.com/pycqa/isort/issues/1796">#1796</a>: Switch to <code>tomli</code> for pyproject.toml configuration loader.</li>
<li>Fixed <a href="https://github-redirect.dependabot.com/pycqa/isort/issues/1801">#1801</a>: CLI bug (--exend-skip-glob, overrides instead of extending).</li>
<li>Fixed <a href="https://github-redirect.dependabot.com/pycqa/isort/issues/1802">#1802</a>: respect PATH customization in nested calls to git.</li>
<li>Fixed <a href="https://github-redirect.dependabot.com/pycqa/isort/issues/1838">#1838</a>: Append only with certain code snippets incorrectly adds imports.</li>
<li>Added official support for Python 3.10</li>
</ul>
<h4>Potentially breaking changes:</h4>
<ul>
<li>Fixed <a href="https://github-redirect.dependabot.com/pycqa/isort/issues/1785">#1785</a>: <code>_ast</code> module incorrectly excluded from stdlib definition.</li>
</ul>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a href="https://github.com/PyCQA/isort/commit/c5e8fa75dda5f764d20f66a215d71c21cfa198e1"><code>c5e8fa7</code></a> Fix membership check</li>
<li><a href="https://github.com/PyCQA/isort/commit/3ce9f8f77fddd5eeda4b890b87979bd5f1815af5"><code>3ce9f8f</code></a> Bump version to 5.10.1</li>
<li><a href="https://github.com/PyCQA/isort/commit/fa2de4761040a9fd82339fccc7cc42391eb082cf"><code>fa2de47</code></a> Mark <a href="https://github-redirect.dependabot.com/pycqa/isort/issues/1840">#1840</a> as fixed</li>
<li><a href="https://github.com/PyCQA/isort/commit/ca084113ad381db3a9497bdabdf5c1de39706cb1"><code>ca08411</code></a> Fixed <a href="https://github-redirect.dependabot.com/pycqa/isort/issues/1819">#1819</a>: Occasional inconsistency with multiple src paths.</li>
<li><a href="https://github.com/PyCQA/isort/commit/dbd18429cf566e9554842c9322515237bd8efb49"><code>dbd1842</code></a> Merge pull request <a href="https://github-redirect.dependabot.com/pycqa/isort/issues/1845">#1845</a> from PyCQA/revert-1833-bug/do_not_skip_string</li>
<li><a href="https://github.com/PyCQA/isort/commit/dcbf92fbaaf1a971e96746c47eb91e35e7badc07"><code>dcbf92f</code></a> Revert &quot;only skip real comments&quot;</li>
<li><a href="https://github.com/PyCQA/isort/commit/c154ecff496bf9309eaf5d887f4aa4a0abba28a2"><code>c154ecf</code></a> Bump version to 5.10.0</li>
<li><a href="https://github.com/PyCQA/isort/commit/7a13f31eab7bcb692b1f5b537b124464018c1889"><code>7a13f31</code></a> Add changelog for 5.10</li>
<li><a href="https://github.com/PyCQA/isort/commit/73245e942de97fe1a4a2d968bbde3c168a97e64c"><code>73245e9</code></a> Fixes <a href="https://github-redirect.dependabot.com/pycqa/isort/issues/1838">#1838</a>: don't append imports where no imports are present</li>
<li><a href="https://github.com/PyCQA/isort/commit/223dc4cdf41e5557f28498b050a5ef1c02fef50c"><code>223dc4c</code></a> Remove unused import</li>
<li>Additional commits viewable in <a href="https://github.com/pycqa/isort/compare/5.9.3...5.10.1">compare view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=isort&package-manager=pip&previous-version=5.9.3&new-version=5.10.1)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
- `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)


</details>
qujingpengf added a commit to qujingpengf/ChrisRBe that referenced this issue Jan 22, 2022
430: build(deps): bump isort from 5.9.3 to 5.10.0 r=ChrisRBe a=dependabot[bot]

Bumps [isort](https://github.com/pycqa/isort) from 5.9.3 to 5.10.0.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a href="https://github.com/pycqa/isort/releases">isort's releases</a>.</em></p>
<blockquote>
<h2>5.10.0</h2>
<pre><code>Implemented [#1796](PyCQA/isort#1796): Switch to tomli for pyproject.toml configuration loader.
Fixed [#1801](PyCQA/isort#1801): CLI bug (--exend-skip-glob, overrides instead of extending).
Fixed [#1802](PyCQA/isort#1802): respect PATH customization in nested calls to git.
Fixed [#1838](PyCQA/isort#1838): Append only with certain code snippets incorrectly adds imports.
Added official support for Python 3.10
</code></pre>
</blockquote>
</details>
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a href="https://github.com/PyCQA/isort/blob/main/CHANGELOG.md">isort's changelog</a>.</em></p>
<blockquote>
<h3>5.10.0 November 3 2021</h3>
<ul>
<li>Implemented <a href="https://github-redirect.dependabot.com/pycqa/isort/issues/1796">#1796</a>: Switch to <code>tomli</code> for pyproject.toml configuration loader.</li>
<li>Fixed <a href="https://github-redirect.dependabot.com/pycqa/isort/issues/1801">#1801</a>: CLI bug (--exend-skip-glob, overrides instead of extending).</li>
<li>Fixed <a href="https://github-redirect.dependabot.com/pycqa/isort/issues/1802">#1802</a>: respect PATH customization in nested calls to git.</li>
<li>Fixed <a href="https://github-redirect.dependabot.com/pycqa/isort/issues/1838">#1838</a>: Append only with certain code snippets incorrectly adds imports.</li>
<li>Added official support for Python 3.10</li>
</ul>
<h4>Potentially breaking changes:</h4>
<ul>
<li>Fixed <a href="https://github-redirect.dependabot.com/pycqa/isort/issues/1785">#1785</a>: <code>_ast</code> module incorrectly excluded from stdlib definition.</li>
</ul>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a href="https://github.com/PyCQA/isort/commit/c154ecff496bf9309eaf5d887f4aa4a0abba28a2"><code>c154ecf</code></a> Bump version to 5.10.0</li>
<li><a href="https://github.com/PyCQA/isort/commit/7a13f31eab7bcb692b1f5b537b124464018c1889"><code>7a13f31</code></a> Add changelog for 5.10</li>
<li><a href="https://github.com/PyCQA/isort/commit/73245e942de97fe1a4a2d968bbde3c168a97e64c"><code>73245e9</code></a> Fixes <a href="https://github-redirect.dependabot.com/pycqa/isort/issues/1838">#1838</a>: don't append imports where no imports are present</li>
<li><a href="https://github.com/PyCQA/isort/commit/223dc4cdf41e5557f28498b050a5ef1c02fef50c"><code>223dc4c</code></a> Remove unused import</li>
<li><a href="https://github.com/PyCQA/isort/commit/488cdcac10d4775d9ac2b63401a9a024a43705cf"><code>488cdca</code></a> Fix formatting</li>
<li><a href="https://github.com/PyCQA/isort/commit/1f093f691038e35303eb326e5a82b7cfcd918753"><code>1f093f6</code></a> Merge pull request <a href="https://github-redirect.dependabot.com/pycqa/isort/issues/1833">#1833</a> from chrisdecker1201/bug/do_not_skip_string</li>
<li><a href="https://github.com/PyCQA/isort/commit/3c5da48559a4052b47f170c1a3fe3cdd5bd928da"><code>3c5da48</code></a> use regex to mach file_skip</li>
<li><a href="https://github.com/PyCQA/isort/commit/4e3f64bf91b50c9d2923c60853e0701ab04f388f"><code>4e3f64b</code></a> fix linter</li>
<li><a href="https://github.com/PyCQA/isort/commit/ba81f1c933a11e3391af3ad89d6cf2b38dcdf4ee"><code>ba81f1c</code></a> Merge pull request <a href="https://github-redirect.dependabot.com/pycqa/isort/issues/1834">#1834</a> from pzelnip/patch-1</li>
<li><a href="https://github.com/PyCQA/isort/commit/b1c5d7b2768f6c575929a6d9d1c7c6731454f670"><code>b1c5d7b</code></a> Minor improvements to pre-commit.md</li>
<li>Additional commits viewable in <a href="https://github.com/pycqa/isort/compare/5.9.3...5.10.0">compare view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=isort&package-manager=pip&previous-version=5.9.3&new-version=5.10.0)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting ``@dependabot` rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- ``@dependabot` rebase` will rebase this PR
- ``@dependabot` recreate` will recreate this PR, overwriting any edits that have been made to it
- ``@dependabot` merge` will merge this PR after your CI passes on it
- ``@dependabot` squash and merge` will squash and merge this PR after your CI passes on it
- ``@dependabot` cancel merge` will cancel a previously requested merge and block automerging
- ``@dependabot` reopen` will reopen this PR if it is closed
- ``@dependabot` close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
- ``@dependabot` ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
- ``@dependabot` ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
- ``@dependabot` ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)


</details>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant