Skip to content

Conversation

@harupy
Copy link
Contributor

@harupy harupy commented Oct 10, 2023

Summary

Close #5933

Test Plan

cargo test

@github-actions
Copy link
Contributor

github-actions bot commented Oct 10, 2023

PR Check Results

Ecosystem

ℹ️ ecosystem check detected changes. (+6, -6, 0 error(s))

airflow (+4, -4)

- [*] 16066 fixable with the `--fix` option (6343 hidden fixes can be enabled with the `--unsafe-fixes` option).
+ [*] 16069 fixable with the `--fix` option (6343 hidden fixes can be enabled with the `--unsafe-fixes` option).
- airflow/providers/google/cloud/hooks/bigquery.py:1580:35: PYI055 Multiple `type` members in a union. Combine them into one, e.g., `type[CopyJob | QueryJob | LoadJob | ExtractJob]`.
+ airflow/providers/google/cloud/hooks/bigquery.py:1580:35: PYI055 [*] Multiple `type` members in a union. Combine them into one, e.g., `type[CopyJob | QueryJob | LoadJob | ExtractJob]`.
- airflow/providers/google/cloud/hooks/bigquery.py:1587:14: PYI055 Multiple `type` members in a union. Combine them into one, e.g., `type[CopyJob | QueryJob | LoadJob | ExtractJob]`.
+ airflow/providers/google/cloud/hooks/bigquery.py:1587:14: PYI055 [*] Multiple `type` members in a union. Combine them into one, e.g., `type[CopyJob | QueryJob | LoadJob | ExtractJob]`.
- airflow/providers/smtp/hooks/smtp.py:103:15: PYI055 Multiple `type` members in a union. Combine them into one, e.g., `type[smtplib.SMTP_SSL | smtplib.SMTP]`.
+ airflow/providers/smtp/hooks/smtp.py:103:15: PYI055 [*] Multiple `type` members in a union. Combine them into one, e.g., `type[smtplib.SMTP_SSL | smtplib.SMTP]`.

bokeh (+2, -2)

- [*] 17800 fixable with the `--fix` option (4727 hidden fixes can be enabled with the `--unsafe-fixes` option).
+ [*] 17801 fixable with the `--fix` option (4727 hidden fixes can be enabled with the `--unsafe-fixes` option).
- src/bokeh/core/validation/decorators.py:67:13: PYI055 Multiple `type` members in a union. Combine them into one, e.g., `type[Error | Warning]`.
+ src/bokeh/core/validation/decorators.py:67:13: PYI055 [*] Multiple `type` members in a union. Combine them into one, e.g., `type[Error | Warning]`.

Rules changed: 1
Rule Changes Additions Removals
PYI055 8 4 4

Comment on lines +8 to +9
3 | if "k" in d and d["k"]:
| ^^^^^^^^^^^^^^^^^^^ RUF019
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Future improvements could be to also support other checks like:

if "k" in d and d["k"] == value:
	...

which could be replaced with:

if d.get("k") == value:
	...

Instead of ==, there could be !=, in, not in, etc.

@dhruvmanila dhruvmanila added the rule Implementing or modifying a lint rule label Oct 12, 2023
@harupy harupy force-pushed the unnecessary-key-check branch from d6f0455 to 588449d Compare October 12, 2023 09:09
@charliermarsh charliermarsh enabled auto-merge (squash) October 13, 2023 01:00
@charliermarsh charliermarsh merged commit 6f9c317 into astral-sh:main Oct 13, 2023
@harupy harupy deleted the unnecessary-key-check branch October 13, 2023 01:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

rule Implementing or modifying a lint rule

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Simplify key in dct and dct[key] to dct.get(key)

3 participants