-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
]: Deprecate non-pep604-isinstance
(UP038
)
#16681
Conversation
CodSpeed Performance ReportMerging #16681 will degrade performances by 4.61%Comparing Summary
Benchmarks breakdown
|
|
code | total | + violation | - violation | + fix | - fix |
---|---|---|---|---|---|
UP038 | 39 | 0 | 39 | 0 | 0 |
Linter (preview)
ℹ️ ecosystem check detected linter changes. (+0 -39 violations, +0 -0 fixes in 1 projects; 54 projects unchanged)
apache/superset (+0 -39 violations, +0 -0 fixes)
ruff check --no-cache --exit-zero --ignore RUF9 --no-fix --output-format concise --preview --select ALL
- superset/async_events/async_query_manager.py:269:12: UP038 Use `X | Y` in `isinstance` call instead of `(X, Y)` - superset/cli/main.py:55:12: UP038 Use `X | Y` in `isinstance` call instead of `(X, Y)` - superset/commands/dataset/importers/v1/utils.py:212:12: UP038 Use `X | Y` in `isinstance` call instead of `(X, Y)` - superset/connectors/sqla/models.py:529:17: UP038 Use `X | Y` in `isinstance` call instead of `(X, Y)` - superset/connectors/sqla/models.py:562:12: UP038 Use `X | Y` in `isinstance` call instead of `(X, Y)` - superset/connectors/sqla/models.py:566:35: UP038 Use `X | Y` in `isinstance` call instead of `(X, Y)` - superset/connectors/sqla/models.py:568:37: UP038 Use `X | Y` in `isinstance` call instead of `(X, Y)` - superset/db_engine_specs/cockroachdb.py:36:12: UP038 Use `X | Y` in `isinstance` call instead of `(X, Y)` - superset/db_engine_specs/databend.py:326:16: UP038 Use `X | Y` in `isinstance` call instead of `(X, Y)` - superset/db_engine_specs/druid.py:116:12: UP038 Use `X | Y` in `isinstance` call instead of `(X, Y)` - superset/db_engine_specs/duckdb.py:229:12: UP038 Use `X | Y` in `isinstance` call instead of `(X, Y)` - superset/db_engine_specs/dynamodb.py:64:12: UP038 Use `X | Y` in `isinstance` call instead of `(X, Y)` - superset/db_engine_specs/sqlite.py:120:12: UP038 Use `X | Y` in `isinstance` call instead of `(X, Y)` - superset/models/core.py:633:21: UP038 Use `X | Y` in `isinstance` call instead of `(X, Y)` - superset/models/helpers.py:1164:17: UP038 Use `X | Y` in `isinstance` call instead of `(X, Y)` - superset/models/helpers.py:1197:12: UP038 Use `X | Y` in `isinstance` call instead of `(X, Y)` - superset/models/helpers.py:1201:35: UP038 Use `X | Y` in `isinstance` call instead of `(X, Y)` - superset/models/helpers.py:1203:37: UP038 Use `X | Y` in `isinstance` call instead of `(X, Y)` - superset/models/helpers.py:1833:28: UP038 Use `X | Y` in `isinstance` call instead of `(X, Y)` - superset/sql/parse.py:365:16: UP038 Use `X | Y` in `isinstance` call instead of `(X, Y)` - superset/sql_parse.py:472:16: UP038 Use `X | Y` in `isinstance` call instead of `(X, Y)` - superset/utils/core.py:377:8: UP038 Use `X | Y` in `isinstance` call instead of `(X, Y)` - superset/utils/core.py:412:8: UP038 Use `X | Y` in `isinstance` call instead of `(X, Y)` - superset/utils/json.py:126:8: UP038 Use `X | Y` in `isinstance` call instead of `(X, Y)` - superset/utils/json.py:157:8: UP038 Use `X | Y` in `isinstance` call instead of `(X, Y)` - superset/utils/json.py:94:8: UP038 Use `X | Y` in `isinstance` call instead of `(X, Y)` - superset/utils/mock_data.py:102:8: UP038 Use `X | Y` in `isinstance` call instead of `(X, Y)` - superset/utils/mock_data.py:117:8: UP038 Use `X | Y` in `isinstance` call instead of `(X, Y)` - superset/utils/mock_data.py:140:8: UP038 Use `X | Y` in `isinstance` call instead of `(X, Y)` - superset/utils/mock_data.py:73:8: UP038 Use `X | Y` in `isinstance` call instead of `(X, Y)` - superset/utils/mock_data.py:81:8: UP038 Use `X | Y` in `isinstance` call instead of `(X, Y)` - superset/utils/mock_data.py:89:8: UP038 Use `X | Y` in `isinstance` call instead of `(X, Y)` - superset/utils/mock_data.py:97:8: UP038 Use `X | Y` in `isinstance` call instead of `(X, Y)` - superset/utils/pandas_postprocessing/boxplot.py:81:17: UP038 Use `X | Y` in `isinstance` call instead of `(X, Y)` - superset/utils/pandas_postprocessing/boxplot.py:83:20: UP038 Use `X | Y` in `isinstance` call instead of `(X, Y)` - superset/utils/pandas_postprocessing/boxplot.py:84:20: UP038 Use `X | Y` in `isinstance` call instead of `(X, Y)` - superset/viz.py:1596:59: UP038 Use `X | Y` in `isinstance` call instead of `(X, Y)` - superset/viz.py:970:17: UP038 Use `X | Y` in `isinstance` call instead of `(X, Y)` - tests/integration_tests/base_tests.py:193:20: UP038 Use `X | Y` in `isinstance` call instead of `(X, Y)`
Changes by rule (1 rules affected)
code | total | + violation | - violation | + fix | - fix |
---|---|---|---|---|---|
UP038 | 39 | 0 | 39 | 0 | 0 |
a6217f2
to
9511be4
Compare
## Summary This PR deprecates UP038. Using PEP 604 syntax in `isinstance` and `issubclass` calls isn't a recommended pattern (or community agreed best practice) and it negatively impacts performance. Resolves #7871 ## Test Plan I tested that selecting `UP038` results in a warning in no-preview mode and an error in preview mode
## Summary This PR deprecates UP038. Using PEP 604 syntax in `isinstance` and `issubclass` calls isn't a recommended pattern (or community agreed best practice) and it negatively impacts performance. Resolves #7871 ## Test Plan I tested that selecting `UP038` results in a warning in no-preview mode and an error in preview mode
* main: (53 commits) [syntax-errors] Tuple unpacking in `for` statement iterator clause before Python 3.9 (#16558) Ruff v0.10 Release (#16708) Add new `noqa` specification to the docs (#16703) describe requires-python fallback in docs (#16704) [red-knot] handle cycles in MRO/bases resolution (#16693) [red-knot] Auto generate statement nodes (#16645) [`pylint`] Better inference for `str.strip` (`PLE310`) (#16671) [`pylint`] Improve `repeated-equality-comparison` fix to use a `set` when all elements are hashable (`PLR1714`) (#16685) [`pylint`/`pep8-naming`] Check `__new__` argument name in `bad-staticmethod-argument` and not `invalid-first-argument-name-for-class-method` (`PLW0211`/`N804`) (#16676) [`flake8-pyi`] Stabilize fix for `unused-private-type-var` (`PYI018`) (#16682) [`flake8-bandit`] Deprecate `suspicious-xmle-tree-usage` (`S320`) (#16680) [`flake8-simplify`] Avoid double negation in fixes (`SIM103`) (#16684) [`pyupgrade`]: Improve diagnostic range for `redundant-open-mode` (`UP015`) (#16672) Consider all `TYPE_CHECKING` symbols for type-checking blocks (#16669) [`pep8-naming`]: Ignore methods decorated with `@typing.override` (`invalid-argument-name`) (#16667) Stabilize FURB169 preview behavior (#16666) [`pylint`] Detect invalid default value type for `os.environ.get` (`PLW1508`) (#16674) [`flake8-pytest-style`] Allow for loops with empty bodies (`PT012`, `PT031`) (#16678) [`pyupgrade`]: Deprecate `non-pep604-isinstance` (`UP038`) (#16681) [`flake8-type-checking`] Stabilize `runtime-cast-value` (`TC006`) (#16637) ...
Summary
This PR deprecates UP038. Using PEP 604 syntax in
isinstance
andissubclass
calls isn't a recommended pattern (or community agreed best practice)and it negatively impacts performance.
Resolves #7871
Test Plan
I tested that selecting
UP038
results in a warning in no-preview mode and an error in preview mode