-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
[pyupgrade
] Handle multiple base classes for PEP 695 generics (UP046
)
#15659
Draft
ntBre
wants to merge
3
commits into
brent/pep695-generics
Choose a base branch
from
brent/pep695-multi-base
base: brent/pep695-generics
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+59
−18
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
|
code | total | + violation | - violation | + fix | - fix |
---|---|---|---|---|---|
I001 | 342 | 171 | 171 | 0 | 0 |
SIM201 | 30 | 0 | 0 | 30 | 0 |
Linter (preview)
ℹ️ ecosystem check detected linter changes. (+179 -193 violations, +30 -0 fixes in 7 projects; 48 projects unchanged)
apache/airflow (+5 -16 violations, +26 -0 fixes)
ruff check --no-cache --exit-zero --ignore RUF9 --no-fix --output-format concise --preview --select ALL
+ airflow/configuration.py:1259:13: SIM103 Return the condition `not value is None` directly - airflow/configuration.py:1259:13: SIM103 Return the condition `value is not None` directly - airflow/models/baseoperator.py:168:38: SIM201 Use `sentinel != _sentinel` instead of `not sentinel == _sentinel` + airflow/models/baseoperator.py:168:38: SIM201 [*] Use `sentinel != _sentinel` instead of `not sentinel == _sentinel` - airflow/models/dag.py:822:44: SIM201 Use `ti.state != State.NONE` instead of `not ti.state == State.NONE` + airflow/models/dag.py:822:44: SIM201 [*] Use `ti.state != State.NONE` instead of `not ti.state == State.NONE` - airflow/www/views.py:5625:12: SIM201 Use `os.environ.get("AIRFLOW_ENV", None) != "development"` instead of `not os.environ.get("AIRFLOW_ENV", None) == "development"` + airflow/www/views.py:5625:12: SIM201 [*] Use `os.environ.get("AIRFLOW_ENV", None) != "development"` instead of `not os.environ.get("AIRFLOW_ENV", None) == "development"` ... 21 additional changes omitted for rule SIM201 + providers/src/airflow/providers/amazon/aws/sensors/athena.py:94:9: SIM103 Return the condition `not state in self.INTERMEDIATE_STATES` directly - providers/src/airflow/providers/amazon/aws/sensors/athena.py:94:9: SIM103 Return the condition `state not in self.INTERMEDIATE_STATES` directly ... 37 additional changes omitted for project
apache/superset (+1 -2 violations, +0 -0 fixes)
ruff check --no-cache --exit-zero --ignore RUF9 --no-fix --output-format concise --preview --select ALL
+ superset/commands/importers/v1/utils.py:204:5: SIM103 Return the condition `not path.suffix.lower() not in {".yaml", ".yml"}` directly - superset/commands/importers/v1/utils.py:204:5: SIM103 Return the condition `path.suffix.lower() in {".yaml", ".yml"}` directly - superset/migrations/versions/2023-05-01_12-03_9c2a5681ddfd_convert_key_value_entries_to_json.py:46:27: S301 `pickle` and modules that wrap it can be unsafe when used to deserialize untrusted data, possible security issue
binary-husky/gpt_academic (+166 -166 violations, +0 -0 fixes)
ruff check --no-cache --exit-zero --ignore RUF9 --no-fix --output-format concise --preview
+ check_proxy.py:119:1: I001 [*] Import block is un-sorted or un-formatted - check_proxy.py:119:5: I001 [*] Import block is un-sorted or un-formatted + check_proxy.py:179:1: I001 [*] Import block is un-sorted or un-formatted - check_proxy.py:179:9: I001 [*] Import block is un-sorted or un-formatted + check_proxy.py:226:1: I001 [*] Import block is un-sorted or un-formatted - check_proxy.py:226:5: I001 [*] Import block is un-sorted or un-formatted + check_proxy.py:57:1: I001 [*] Import block is un-sorted or un-formatted - check_proxy.py:57:5: I001 [*] Import block is un-sorted or un-formatted + check_proxy.py:76:1: I001 [*] Import block is un-sorted or un-formatted - check_proxy.py:76:5: I001 [*] Import block is un-sorted or un-formatted + crazy_functional.py:6:1: I001 [*] Import block is un-sorted or un-formatted - crazy_functional.py:6:5: I001 [*] Import block is un-sorted or un-formatted + crazy_functions/Conversation_To_File.py:11:1: I001 [*] Import block is un-sorted or un-formatted - crazy_functions/Conversation_To_File.py:11:5: I001 [*] Import block is un-sorted or un-formatted + crazy_functions/Conversation_To_File.py:210:1: I001 [*] Import block is un-sorted or un-formatted - crazy_functions/Conversation_To_File.py:210:5: I001 [*] Import block is un-sorted or un-formatted + crazy_functions/Image_Generate.py:159:1: I001 [*] Import block is un-sorted or un-formatted - crazy_functions/Image_Generate.py:159:9: I001 [*] Import block is un-sorted or un-formatted + crazy_functions/Image_Generate.py:50:1: I001 [*] Import block is un-sorted or un-formatted - crazy_functions/Image_Generate.py:50:5: I001 [*] Import block is un-sorted or un-formatted + crazy_functions/Image_Generate.py:6:1: I001 [*] Import block is un-sorted or un-formatted - crazy_functions/Image_Generate.py:6:5: I001 [*] Import block is un-sorted or un-formatted + crazy_functions/Latex_Function.py:266:1: I001 [*] Import block is un-sorted or un-formatted - crazy_functions/Latex_Function.py:266:9: I001 [*] Import block is un-sorted or un-formatted + crazy_functions/Latex_Function.py:354:1: I001 [*] Import block is un-sorted or un-formatted - crazy_functions/Latex_Function.py:354:9: I001 [*] Import block is un-sorted or un-formatted - crazy_functions/Latex_Function.py:431:13: I001 [*] Import block is un-sorted or un-formatted + crazy_functions/Latex_Function.py:431:1: I001 [*] Import block is un-sorted or un-formatted + crazy_functions/Latex_Function.py:471:1: I001 [*] Import block is un-sorted or un-formatted - crazy_functions/Latex_Function.py:471:9: I001 [*] Import block is un-sorted or un-formatted + crazy_functions/Latex_Function.py:70:1: I001 [*] Import block is un-sorted or un-formatted - crazy_functions/Latex_Function.py:70:5: I001 [*] Import block is un-sorted or un-formatted + crazy_functions/Latex_Project_Polish.py:155:1: I001 [*] Import block is un-sorted or un-formatted - crazy_functions/Latex_Project_Polish.py:155:5: I001 [*] Import block is un-sorted or un-formatted + crazy_functions/Latex_Project_Polish.py:193:1: I001 [*] Import block is un-sorted or un-formatted - crazy_functions/Latex_Project_Polish.py:193:5: I001 [*] Import block is un-sorted or un-formatted + crazy_functions/Latex_Project_Polish.py:229:1: I001 [*] Import block is un-sorted or un-formatted - crazy_functions/Latex_Project_Polish.py:229:5: I001 [*] Import block is un-sorted or un-formatted - crazy_functions/Latex_Project_Polish.py:29:17: I001 [*] Import block is un-sorted or un-formatted + crazy_functions/Latex_Project_Polish.py:29:1: I001 [*] Import block is un-sorted or un-formatted + crazy_functions/Latex_Project_Polish.py:51:1: I001 [*] Import block is un-sorted or un-formatted ... 291 additional changes omitted for project
bokeh/bokeh (+5 -5 violations, +2 -0 fixes)
ruff check --no-cache --exit-zero --ignore RUF9 --no-fix --output-format concise --preview --select ALL
+ examples/server/app/gapminder/data.py:5:1: I001 [*] Import block is un-sorted or un-formatted - examples/server/app/gapminder/data.py:5:5: I001 [*] Import block is un-sorted or un-formatted + src/bokeh/model/model.py:46:1: I001 [*] Import block is un-sorted or un-formatted - src/bokeh/model/model.py:46:5: I001 [*] Import block is un-sorted or un-formatted + src/bokeh/model/util.py:167:1: I001 [*] Import block is un-sorted or un-formatted - src/bokeh/model/util.py:167:5: I001 [*] Import block is un-sorted or un-formatted ... 5 additional changes omitted for rule I001 - src/bokeh/server/views/ws.py:168:12: SIM201 Use `len(subprotocols) != 2` instead of `not len(subprotocols) == 2` + src/bokeh/server/views/ws.py:168:12: SIM201 [*] Use `len(subprotocols) != 2` instead of `not len(subprotocols) == 2` ... 4 additional changes omitted for project
latchbio/latch (+0 -0 violations, +2 -0 fixes)
ruff check --no-cache --exit-zero --ignore RUF9 --no-fix --output-format concise --preview
- src/latch_cli/services/sync.py:142:12: SIM201 Use `dest[-1] != "/"` instead of `not dest[-1] == "/"` + src/latch_cli/services/sync.py:142:12: SIM201 [*] Use `dest[-1] != "/"` instead of `not dest[-1] == "/"`
lnbits/lnbits (+0 -2 violations, +0 -0 fixes)
ruff check --no-cache --exit-zero --ignore RUF9 --no-fix --output-format concise --preview
- lnbits/core/crud.py:791:5: RUF047 [*] Empty `else` clause - lnbits/core/crud.py:800:5: RUF047 [*] Empty `else` clause
zulip/zulip (+2 -2 violations, +0 -0 fixes)
ruff check --no-cache --exit-zero --ignore RUF9 --no-fix --output-format concise --preview --select ALL
+ zerver/lib/message.py:1539:5: SIM103 Return the condition `not user_profile.realm != message.get_realm()` directly - zerver/lib/message.py:1539:5: SIM103 Return the condition `user_profile.realm == message.get_realm()` directly - zerver/views/custom_profile_fields.py:82:5: SIM103 Return the condition `field_data["subtype"] != "custom"` directly + zerver/views/custom_profile_fields.py:82:5: SIM103 Return the condition `not field_data["subtype"] == "custom"` directly
Changes by rule (7 rules affected)
code | total | + violation | - violation | + fix | - fix |
---|---|---|---|---|---|
I001 | 342 | 171 | 171 | 0 | 0 |
SIM201 | 30 | 0 | 0 | 30 | 0 |
SIM103 | 16 | 8 | 8 | 0 | 0 |
S321 | 6 | 0 | 6 | 0 | 0 |
RUF047 | 6 | 0 | 6 | 0 | 0 |
S307 | 1 | 0 | 1 | 0 | 0 |
S301 | 1 | 0 | 1 | 0 | 0 |
ntBre
force-pushed
the
brent/pep695-multi-base
branch
from
January 22, 2025 15:06
9ff1143
to
fcca976
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Addresses the second follow up to #15565 in #15642. This was easier than expected by using this cool destructuring syntax I don't think I've used before.
I'll leave it as a draft until #15565 is merged and then update the base branch.
Test Plan
Using an existing test, previously marked as a TODO.