-
-
Notifications
You must be signed in to change notification settings - Fork 23
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
C402 false positive with extra kwargs to dict() #457
Comments
Fixed in #458, released in 3.10.1. Thanks for the report. |
MartinHjelmare
pushed a commit
to home-assistant-libs/pytradfri
that referenced
this issue
Oct 31, 2022
Bumps [flake8-comprehensions](https://github.com/adamchainz/flake8-comprehensions) from 3.10.0 to 3.10.1. <details> <summary>Changelog</summary> <p><em>Sourced from <a href="https://github.com/adamchainz/flake8-comprehensions/blob/main/HISTORY.rst">flake8-comprehensions's changelog</a>.</em></p> <blockquote> <h2>3.10.1 (2022-10-29)</h2> <ul> <li> <p>Fix false positive in rules C402 and C404 for <code>dict()</code> calls with keyword arguments.</p> <p>Thanks to Anders Kaseorg for the report in <code>Issue [#457](adamchainz/flake8-comprehensions#457) <https://github.com/adamchainz/flake8-comprehensions/issues/457></code>__.</p> </li> </ul> </blockquote> </details> <details> <summary>Commits</summary> <ul> <li><a href="https://github.com/adamchainz/flake8-comprehensions/commit/1eb8823d91f7d77d6cd54c212cb3b2cc58122099"><code>1eb8823</code></a> Version 3.10.1</li> <li><a href="https://github.com/adamchainz/flake8-comprehensions/commit/e655c2648513dc0e57e17cac6b70468b42338c89"><code>e655c26</code></a> Fix C402/C404 false positive for dict() with kwargs (<a href="https://github-redirect.dependabot.com/adamchainz/flake8-comprehensions/issues/458">#458</a>)</li> <li><a href="https://github.com/adamchainz/flake8-comprehensions/commit/7d8f47f93acbf89d79671c2745ef102c1c84de21"><code>7d8f47f</code></a> Test with Python 3.11.0 (<a href="https://github-redirect.dependabot.com/adamchainz/flake8-comprehensions/issues/456">#456</a>)</li> <li><a href="https://github.com/adamchainz/flake8-comprehensions/commit/26681c62d031f1c8828268e350fcaac6bc958dcf"><code>26681c6</code></a> Upgrade requirements (<a href="https://github-redirect.dependabot.com/adamchainz/flake8-comprehensions/issues/455">#455</a>)</li> <li><a href="https://github.com/adamchainz/flake8-comprehensions/commit/4fb5a39ccd3746caaa33122e2d1aa72b72d7aff6"><code>4fb5a39</code></a> [pre-commit.ci] pre-commit autoupdate (<a href="https://github-redirect.dependabot.com/adamchainz/flake8-comprehensions/issues/453">#453</a>)</li> <li><a href="https://github.com/adamchainz/flake8-comprehensions/commit/778eaad4b7518973c53f56604eb11d6c927628ef"><code>778eaad</code></a> Upgrade GitHub Actions workflows to Ubuntu 22.04 (<a href="https://github-redirect.dependabot.com/adamchainz/flake8-comprehensions/issues/452">#452</a>)</li> <li><a href="https://github.com/adamchainz/flake8-comprehensions/commit/baa8acd66b4582e473d21143ddd3f76887ab9c39"><code>baa8acd</code></a> Add 'Typing :: Typed' PyPI classifier</li> <li><a href="https://github.com/adamchainz/flake8-comprehensions/commit/76a79c07559f107cf62fd8115fcc85eea0e94181"><code>76a79c0</code></a> [pre-commit.ci] pre-commit autoupdate (<a href="https://github-redirect.dependabot.com/adamchainz/flake8-comprehensions/issues/451">#451</a>)</li> <li><a href="https://github.com/adamchainz/flake8-comprehensions/commit/763cf2a10c3981ad2d85f14fc2c02e33edc5a672"><code>763cf2a</code></a> Upgrade to Mypy 0.981</li> <li><a href="https://github.com/adamchainz/flake8-comprehensions/commit/eb96bb6a11b9db8947d86a8ccdd4a95bf9ec527d"><code>eb96bb6</code></a> [pre-commit.ci] pre-commit autoupdate (<a href="https://github-redirect.dependabot.com/adamchainz/flake8-comprehensions/issues/450">#450</a>)</li> <li>Additional commits viewable in <a href="https://github.com/adamchainz/flake8-comprehensions/compare/3.10.0...3.10.1">compare view</a></li> </ul> </details> <br /> [![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=flake8-comprehensions&package-manager=pip&previous-version=3.10.0&new-version=3.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> Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
kodiakhq bot
pushed a commit
to andrewjtorres/marvin
that referenced
this issue
Nov 1, 2022
…kages/ai (#1150) Bumps [flake8-comprehensions](https://github.com/adamchainz/flake8-comprehensions) from 3.10.0 to 3.10.1. <details> <summary>Changelog</summary> <p><em>Sourced from <a href="https://github.com/adamchainz/flake8-comprehensions/blob/main/HISTORY.rst">flake8-comprehensions's changelog</a>.</em></p> <blockquote> <h2>3.10.1 (2022-10-29)</h2> <ul> <li> <p>Fix false positive in rules C402 and C404 for <code>dict()</code> calls with keyword arguments.</p> <p>Thanks to Anders Kaseorg for the report in <code>Issue [#457](adamchainz/flake8-comprehensions#457) <https://github.com/adamchainz/flake8-comprehensions/issues/457></code>__.</p> </li> </ul> </blockquote> </details> <details> <summary>Commits</summary> <ul> <li><a href="https://github.com/adamchainz/flake8-comprehensions/commit/1eb8823d91f7d77d6cd54c212cb3b2cc58122099"><code>1eb8823</code></a> Version 3.10.1</li> <li><a href="https://github.com/adamchainz/flake8-comprehensions/commit/e655c2648513dc0e57e17cac6b70468b42338c89"><code>e655c26</code></a> Fix C402/C404 false positive for dict() with kwargs (<a href="https://github-redirect.dependabot.com/adamchainz/flake8-comprehensions/issues/458">#458</a>)</li> <li><a href="https://github.com/adamchainz/flake8-comprehensions/commit/7d8f47f93acbf89d79671c2745ef102c1c84de21"><code>7d8f47f</code></a> Test with Python 3.11.0 (<a href="https://github-redirect.dependabot.com/adamchainz/flake8-comprehensions/issues/456">#456</a>)</li> <li><a href="https://github.com/adamchainz/flake8-comprehensions/commit/26681c62d031f1c8828268e350fcaac6bc958dcf"><code>26681c6</code></a> Upgrade requirements (<a href="https://github-redirect.dependabot.com/adamchainz/flake8-comprehensions/issues/455">#455</a>)</li> <li><a href="https://github.com/adamchainz/flake8-comprehensions/commit/4fb5a39ccd3746caaa33122e2d1aa72b72d7aff6"><code>4fb5a39</code></a> [pre-commit.ci] pre-commit autoupdate (<a href="https://github-redirect.dependabot.com/adamchainz/flake8-comprehensions/issues/453">#453</a>)</li> <li><a href="https://github.com/adamchainz/flake8-comprehensions/commit/778eaad4b7518973c53f56604eb11d6c927628ef"><code>778eaad</code></a> Upgrade GitHub Actions workflows to Ubuntu 22.04 (<a href="https://github-redirect.dependabot.com/adamchainz/flake8-comprehensions/issues/452">#452</a>)</li> <li><a href="https://github.com/adamchainz/flake8-comprehensions/commit/baa8acd66b4582e473d21143ddd3f76887ab9c39"><code>baa8acd</code></a> Add 'Typing :: Typed' PyPI classifier</li> <li><a href="https://github.com/adamchainz/flake8-comprehensions/commit/76a79c07559f107cf62fd8115fcc85eea0e94181"><code>76a79c0</code></a> [pre-commit.ci] pre-commit autoupdate (<a href="https://github-redirect.dependabot.com/adamchainz/flake8-comprehensions/issues/451">#451</a>)</li> <li><a href="https://github.com/adamchainz/flake8-comprehensions/commit/763cf2a10c3981ad2d85f14fc2c02e33edc5a672"><code>763cf2a</code></a> Upgrade to Mypy 0.981</li> <li><a href="https://github.com/adamchainz/flake8-comprehensions/commit/eb96bb6a11b9db8947d86a8ccdd4a95bf9ec527d"><code>eb96bb6</code></a> [pre-commit.ci] pre-commit autoupdate (<a href="https://github-redirect.dependabot.com/adamchainz/flake8-comprehensions/issues/450">#450</a>)</li> <li>Additional commits viewable in <a href="https://github.com/adamchainz/flake8-comprehensions/compare/3.10.0...3.10.1">compare view</a></li> </ul> </details> <br /> [![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=flake8-comprehensions&package-manager=pip&previous-version=3.10.0&new-version=3.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>
jankatins
referenced
this issue
in jankatins/pr-workflow-example
Mar 16, 2023
[![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [flake8-comprehensions](https://togithub.com/adamchainz/flake8-comprehensions) ([changelog](https://togithub.com/adamchainz/flake8-comprehensions/blob/main/HISTORY.rst)) | `3.10.0` -> `3.10.1` | [![age](https://badges.renovateapi.com/packages/pypi/flake8-comprehensions/3.10.1/age-slim)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://badges.renovateapi.com/packages/pypi/flake8-comprehensions/3.10.1/adoption-slim)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://badges.renovateapi.com/packages/pypi/flake8-comprehensions/3.10.1/compatibility-slim/3.10.0)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://badges.renovateapi.com/packages/pypi/flake8-comprehensions/3.10.1/confidence-slim/3.10.0)](https://docs.renovatebot.com/merge-confidence/) | --- ### Release Notes <details> <summary>adamchainz/flake8-comprehensions</summary> ### [`v3.10.1`](https://togithub.com/adamchainz/flake8-comprehensions/blob/HEAD/CHANGELOG.rst#​3101-2022-10-29) [Compare Source](https://togithub.com/adamchainz/flake8-comprehensions/compare/3.10.0...3.10.1) - Fix false positive in rules C402 and C404 for `dict()` calls with keyword arguments. Thanks to Anders Kaseorg for the report in `Issue #​457 <https://github.com/adamchainz/flake8-comprehensions/issues/457>`\__. </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://app.renovatebot.com/dashboard#github/jankatins/pr-workflow-example). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNS44LjMiLCJ1cGRhdGVkSW5WZXIiOiIzNS44LjMifQ==-->
github-merge-queue bot
pushed a commit
to openvinotoolkit/openvino
that referenced
this issue
Jul 1, 2024
… /src/bindings/python (#25300) Updates the requirements on [flake8-comprehensions](https://github.com/adamchainz/flake8-comprehensions) to permit the latest version. <details> <summary>Changelog</summary> <p><em>Sourced from <a href="https://github.com/adamchainz/flake8-comprehensions/blob/main/CHANGELOG.rst">flake8-comprehensions's changelog</a>.</em></p> <blockquote> <h2>3.15.0 (2024-06-29)</h2> <ul> <li> <p>Add rule C420 to check for dict comprehensions with constant values, encouraging replacement with <code>dict.fromkeys()</code>.</p> <p>Thanks to Tom Kuson in <code>PR [#553](adamchainz/flake8-comprehensions#553) <https://github.com/adamchainz/flake8-comprehensions/pull/553></code>__.</p> </li> </ul> <h2>3.14.0 (2023-07-10)</h2> <ul> <li>Drop Python 3.7 support.</li> </ul> <h2>3.13.0 (2023-06-15)</h2> <ul> <li>Support Python 3.12.</li> </ul> <h2>3.12.0 (2023-04-13)</h2> <ul> <li> <p>Add rule C418 to check for calls passing a dict literal or dict comprehension to <code>dict()</code>.</p> </li> <li> <p>Add rule C419 to check for calls passing a list comprehension to <code>any()</code>/<code>all()</code>.</p> </li> </ul> <h2>3.11.1 (2023-03-21)</h2> <ul> <li> <p>Fix false positives in C406 “unnecessary dict literal”.</p> <p>Fixes <code>Issue [#260](adamchainz/flake8-comprehensions#260) <https://github.com/adamchainz/flake8-comprehensions/issues/260></code>__.</p> </li> </ul> <h2>3.11.0 (2023-03-18)</h2> <ul> <li> <p>Expand C416 to <code>dict</code> comprehensions.</p> <p>Thanks to Aaron Gokaslan in <code>PR [#490](adamchainz/flake8-comprehensions#490) <https://github.com/adamchainz/flake8-comprehensions/pull/490></code>__.</p> </li> </ul> <h2>3.10.1 (2022-10-29)</h2> <ul> <li> <p>Fix false positive in rules C402 and C404 for <code>dict()</code> calls with keyword arguments.</p> <p>Thanks to Anders Kaseorg for the report in <code>Issue [#457](adamchainz/flake8-comprehensions#457) <https://github.com/adamchainz/flake8-comprehensions/issues/457></code>__.</p> </li> </ul> <h2>3.10.0 (2022-05-19)</h2> <ul> <li>Add rule C417 which recommends rewriting use of <code>map()</code> with <code>lambda</code> to an equivalent generator expression or comprehension.</li> </ul> <!-- raw HTML omitted --> </blockquote> <p>... (truncated)</p> </details> <details> <summary>Commits</summary> <ul> <li><a href="https://github.com/adamchainz/flake8-comprehensions/commit/b348af1c22e8ef34e2fd9b501918b4f45002db20"><code>b348af1</code></a> Version 3.15.0</li> <li><a href="https://github.com/adamchainz/flake8-comprehensions/commit/1ae816f430a668ee527d1fd240640cff291b84cb"><code>1ae816f</code></a> Add rule for dict comprehensions with constant values (<a href="https://redirect.github.com/adamchainz/flake8-comprehensions/issues/553">#553</a>)</li> <li><a href="https://github.com/adamchainz/flake8-comprehensions/commit/226a7e0e58b231d8ae47080a4459172b9a29b708"><code>226a7e0</code></a> Improve MyPy configuration</li> <li><a href="https://github.com/adamchainz/flake8-comprehensions/commit/a562c757802890635d0723dfc312be496f2c978b"><code>a562c75</code></a> Tidy pyproject.toml readme and license fields</li> <li><a href="https://github.com/adamchainz/flake8-comprehensions/commit/e609dea5202dd0663a996c11883da7723f69e9c8"><code>e609dea</code></a> [pre-commit.ci] pre-commit autoupdate (<a href="https://redirect.github.com/adamchainz/flake8-comprehensions/issues/579">#579</a>)</li> <li><a href="https://github.com/adamchainz/flake8-comprehensions/commit/9506eef08eca053bbca03fd8d2eef54b6caff5ec"><code>9506eef</code></a> Upgrade requirements (<a href="https://redirect.github.com/adamchainz/flake8-comprehensions/issues/578">#578</a>)</li> <li><a href="https://github.com/adamchainz/flake8-comprehensions/commit/353b7b5f4571ac620fd2db62680cffccc219a2d9"><code>353b7b5</code></a> [pre-commit.ci] pre-commit autoupdate (<a href="https://redirect.github.com/adamchainz/flake8-comprehensions/issues/577">#577</a>)</li> <li><a href="https://github.com/adamchainz/flake8-comprehensions/commit/419907c69778ad9e3c5fedb1a3e6700a9584a680"><code>419907c</code></a> [pre-commit.ci] pre-commit autoupdate (<a href="https://redirect.github.com/adamchainz/flake8-comprehensions/issues/576">#576</a>)</li> <li><a href="https://github.com/adamchainz/flake8-comprehensions/commit/75cf66dc88b690941fac2c1a4e5255d1343a2c87"><code>75cf66d</code></a> Upgrade requirements (<a href="https://redirect.github.com/adamchainz/flake8-comprehensions/issues/575">#575</a>)</li> <li><a href="https://github.com/adamchainz/flake8-comprehensions/commit/b0dd1652ec50fb9e2b50b69aece0f85fd547894a"><code>b0dd165</code></a> [pre-commit.ci] pre-commit autoupdate (<a href="https://redirect.github.com/adamchainz/flake8-comprehensions/issues/574">#574</a>)</li> <li>Additional commits viewable in <a href="https://github.com/adamchainz/flake8-comprehensions/compare/1.0.0...3.15.0">compare view</a></li> </ul> </details> <br /> 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 show <dependency name> ignore conditions` will show all of the ignore conditions of the specified dependency - `@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> Signed-off-by: dependabot[bot] <[email protected]> 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
Python Version
3.10.7
flake8 Version
5.0.4
Package Version
3.10.0
Description
flake8-compehensions gives “C402 Unnecessary generator - rewrite as a dict comprehension” on both of these lines. But the second cannot be rewritten as a dict comprehension due to the extra keyword argument
c
, so only the first should be an error.(Examples in real code.)
The text was updated successfully, but these errors were encountered: