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

[flake8-pyi] Apply redundant-numeric-union to more type expressions (PYI041) #14332

Draft
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

sbrugman
Copy link
Contributor

Summary

Fixes false negatives for redundant numeric unions in other places than function arguments, eg. return types, type aliases

Splitting this change of from #14273 (will rebase once that is merged)

Test Plan

cargo test and reviewed ecosystem results

Copy link
Contributor

ruff-ecosystem results

Linter (stable)

ℹ️ ecosystem check detected linter changes. (+99 -0 violations, +0 -0 fixes in 11 projects; 43 projects unchanged)

PlasmaPy/PlasmaPy (+4 -0 violations, +0 -0 fixes)

+ src/plasmapy/analysis/swept_langmuir/floating_potential.py:221:37: PYI041 Use `float` instead of `int | float`
+ src/plasmapy/formulary/densities.py:159:32: PYI041 Use `float` instead of `int | float`
+ tests/plasma/test_grids.py:261:32: PYI041 Use `float` instead of `int | float`
+ tests/plasma/test_grids.py:302:32: PYI041 Use `float` instead of `int | float`

apache/airflow (+30 -0 violations, +0 -0 fixes)

ruff check --no-cache --exit-zero --ignore RUF9 --output-format concise --no-preview --select ALL

+ airflow/configuration.py:1165:10: PYI041 Use `float` instead of `int | float`
+ airflow/configuration.py:67:14: PYI041 Use `float` instead of `int | float`
+ airflow/jobs/job.py:63:62: PYI041 Use `float` instead of `int | float`
+ airflow/jobs/job.py:65:35: PYI041 Use `float` instead of `int | float`
+ airflow/metrics/otel_logger.py:53:15: PYI041 Use `float` instead of `int | float`
+ airflow/metrics/protocols.py:29:13: PYI041 Use `float` instead of `int | float`
+ airflow/policies.py:109:54: PYI041 Use `float` instead of `int | float`
+ airflow/serialization/helpers.py:28:65: PYI041 Use `float` instead of `int | float`
+ airflow/serialization/serde.py:58:5: PYI041 Use `float` instead of `int | float`
+ airflow/utils/log/colored_log.py:60:33: PYI041 Use `float` instead of `int | float`
+ providers/src/airflow/providers/alibaba/cloud/hooks/analyticdb_spark.py:200:24: PYI041 Use `float` instead of `int | float`
+ providers/src/airflow/providers/alibaba/cloud/hooks/analyticdb_spark.py:300:54: PYI041 Use `float` instead of `int | float`
+ providers/src/airflow/providers/alibaba/cloud/operators/analyticdb_spark.py:182:24: PYI041 Use `float` instead of `int | float`
+ providers/src/airflow/providers/amazon/aws/hooks/glue.py:111:31: PYI041 Use `float` instead of `int | float`
+ providers/src/airflow/providers/apache/livy/hooks/livy.py:339:24: PYI041 Use `float` instead of `int | float`
... 15 additional changes omitted for project

apache/superset (+11 -0 violations, +0 -0 fixes)

ruff check --no-cache --exit-zero --ignore RUF9 --output-format concise --no-preview --select ALL

+ superset/connectors/sqla/models.py:1673:10: PYI041 Use `float` instead of `int | float`
+ superset/db_engine_specs/base.py:875:10: PYI041 Use `float` instead of `int | float`
+ superset/distributed_lock/utils.py:31:15: PYI041 Use `float` instead of `int | float`
+ superset/models/helpers.py:900:10: PYI041 Use `float` instead of `int | float`
+ superset/superset_typing.py:105:15: PYI041 Use `float` instead of `int | float`
+ superset/utils/core.py:349:53: PYI041 Use `float` instead of `int | float`
+ superset/utils/pandas_postprocessing/boxplot.py:34:20: PYI041 Use `float` instead of `int | float`
+ superset/utils/pandas_postprocessing/boxplot.py:34:46: PYI041 Use `float` instead of `int | float`
+ superset/utils/pandas_postprocessing/boxplot.py:34:65: PYI041 Use `float` instead of `int | float`
+ superset/utils/pandas_postprocessing/resample.py:30:26: PYI041 Use `float` instead of `int | float`
... 1 additional changes omitted for project

bokeh/bokeh (+2 -0 violations, +0 -0 fixes)

ruff check --no-cache --exit-zero --ignore RUF9 --output-format concise --no-preview --select ALL

+ src/bokeh/core/property/numeric.py:53:24: PYI041 Use `float` instead of `int | float`
+ tests/support/util/compare.py:50:18: PYI041 Use `float` instead of `int | float`

latchbio/latch (+7 -0 violations, +0 -0 fixes)

+ src/latch/registry/types.py:37:43: PYI041 Use `float` instead of `int | float`
+ src/latch/types/json.py:11:24: PYI041 Use `float` instead of `int | float`
+ src/latch/types/metadata.py:418:28: PYI041 Use `float` instead of `int | float`
+ src/latch_cli/snakemake/config/utils.py:12:24: PYI041 Use `float` instead of `int | float`
+ src/latch_cli/snakemake/config/utils.py:196:50: PYI041 Use `float` instead of `int | float`
+ src/latch_sdk_gql/__init__.py:14:24: PYI041 Use `float` instead of `int | float`
+ src/latch_sdk_gql/utils.py:37:28: PYI041 Use `float` instead of `int | float`

pandas-dev/pandas (+0 -0 violations, +0 -0 fixes)


python/typeshed (+33 -0 violations, +0 -0 fixes)

ruff check --no-cache --exit-zero --ignore RUF9 --output-format concise --no-preview --select E,F,FA,I,PYI,RUF,UP,W

+ stdlib/_sqlite3.pyi:28:26: PYI041 Use `float` instead of `int | float`
+ stdlib/ast.pyi:1076:12: PYI041 Use `complex` instead of `int | float | complex`
+ stdlib/ast.pyi:1694:16: PYI041 Use `complex` instead of `int | float | complex`
+ stdlib/dbm/sqlite3.pyi:13:26: PYI041 Use `float` instead of `int | float`
+ stdlib/fractions.pyi:8:29: PYI041 Use `float` instead of `int | float`
+ stdlib/marshal.pyi:12:5: PYI041 Use `complex` instead of `int | float | complex`
+ stdlib/pstats.pyi:14:24: PYI041 Use `float` instead of `int | float`
+ stdlib/sqlite3/__init__.pyi:216:26: PYI041 Use `float` instead of `int | float`
+ stdlib/tarfile.pyi:531:12: PYI041 Use `float` instead of `int | float`
+ stdlib/xmlrpc/client.pyi:17:5: PYI041 Use `float` instead of `int | float`
+ stubs/assertpy/assertpy/numeric.pyi:6:23: PYI041 Use `float` instead of `int | float`
+ stubs/docker/docker/_types.pyi:10:19: PYI041 Use `float` instead of `int | float`
+ stubs/fpdf2/fpdf/drawing.pyi:19:21: PYI041 Use `float` instead of `int | float`
+ stubs/gdb/gdb/__init__.pyi:74:29: PYI041 Use `float` instead of `int | float`
+ stubs/gevent/gevent/timeout.pyi:16:26: PYI041 Use `float` instead of `int | float`
+ stubs/hdbcli/hdbcli/dbapi.pyi:135:14: PYI041 Use `complex` instead of `int | float | complex`
... 17 additional changes omitted for project

rotki/rotki (+1 -0 violations, +0 -0 fixes)

+ rotkehlchen/fval.py:8:27: PYI041 Use `float` instead of `int | float`

zulip/zulip (+4 -0 violations, +0 -0 fixes)

ruff check --no-cache --exit-zero --ignore RUF9 --output-format concise --no-preview --select ALL

+ zerver/lib/data_types.py:116:28: PYI041 Use `float` instead of `int | float`
+ zerver/lib/drafts.py:33:16: PYI041 Use `float` instead of `int | float`
+ zerver/openapi/markdown_extension.py:257:64: PYI041 Use `float` instead of `int | float`
+ zilencer/views.py:588:16: PYI041 Use `float` instead of `int | float`

python-trio/trio (+6 -0 violations, +0 -0 fixes)

+ src/trio/_channel.py:114:22: PYI041 Use `float` instead of `int | float`
+ src/trio/_channel.py:123:22: PYI041 Use `float` instead of `int | float`
+ src/trio/_sync.py:159:19: PYI041 Use `float` instead of `int | float`
+ src/trio/_sync.py:229:28: PYI041 Use `float` instead of `int | float`
+ src/trio/_sync.py:236:31: PYI041 Use `float` instead of `int | float`
+ src/trio/_sync.py:270:35: PYI041 Use `float` instead of `int | float`

pytest-dev/pytest (+1 -0 violations, +0 -0 fixes)

+ src/_pytest/mark/structures.py:472:27: PYI041 Use `float` instead of `int | float`

Changes by rule (1 rules affected)

code total + violation - violation + fix - fix
PYI041 99 99 0 0 0

Linter (preview)

ℹ️ ecosystem check detected linter changes. (+63 -5 violations, +66 -0 fixes in 10 projects; 44 projects unchanged)

PlasmaPy/PlasmaPy (+4 -0 violations, +0 -0 fixes)

ruff check --no-cache --exit-zero --ignore RUF9 --output-format concise --preview

+ src/plasmapy/analysis/swept_langmuir/floating_potential.py:221:37: PYI041 [*] Use `float` instead of `int | float`
+ src/plasmapy/formulary/densities.py:159:32: PYI041 [*] Use `float` instead of `int | float`
+ tests/plasma/test_grids.py:261:32: PYI041 [*] Use `float` instead of `int | float`
+ tests/plasma/test_grids.py:302:32: PYI041 [*] Use `float` instead of `int | float`

apache/airflow (+30 -0 violations, +58 -0 fixes)

ruff check --no-cache --exit-zero --ignore RUF9 --output-format concise --preview --select ALL

+ airflow/configuration.py:1165:10: PYI041 [*] Use `float` instead of `int | float`
+ airflow/configuration.py:67:14: PYI041 [*] Use `float` instead of `int | float`
- airflow/decorators/__init__.pyi:117:25: PYI041 Use `float` instead of `int | float`
+ airflow/decorators/__init__.pyi:117:25: PYI041 [*] Use `float` instead of `int | float`
- airflow/decorators/__init__.pyi:256:25: PYI041 Use `float` instead of `int | float`
+ airflow/decorators/__init__.pyi:256:25: PYI041 [*] Use `float` instead of `int | float`
- airflow/jobs/job.py:308:39: PYI041 Use `float` instead of `int | float`
+ airflow/jobs/job.py:308:39: PYI041 [*] Use `float` instead of `int | float`
+ airflow/jobs/job.py:63:62: PYI041 [*] Use `float` instead of `int | float`
+ airflow/jobs/job.py:65:35: PYI041 [*] Use `float` instead of `int | float`
- airflow/metrics/base_stats_logger.py:39:15: PYI041 Use `float` instead of `int | float`
+ airflow/metrics/base_stats_logger.py:39:15: PYI041 [*] Use `float` instead of `int | float`
- airflow/metrics/base_stats_logger.py:50:15: PYI041 Use `float` instead of `int | float`
+ airflow/metrics/base_stats_logger.py:50:15: PYI041 [*] Use `float` instead of `int | float`
- airflow/metrics/base_stats_logger.py:61:15: PYI041 Use `float` instead of `int | float`
+ airflow/metrics/base_stats_logger.py:61:15: PYI041 [*] Use `float` instead of `int | float`
- airflow/metrics/datadog_logger.py:113:16: PYI041 Use `float` instead of `int | float`
+ airflow/metrics/datadog_logger.py:113:16: PYI041 [*] Use `float` instead of `int | float`
- airflow/metrics/otel_logger.py:246:16: PYI041 Use `float` instead of `int | float`
+ airflow/metrics/otel_logger.py:246:16: PYI041 [*] Use `float` instead of `int | float`
+ airflow/metrics/otel_logger.py:53:15: PYI041 [*] Use `float` instead of `int | float`
+ airflow/metrics/protocols.py:29:13: PYI041 [*] Use `float` instead of `int | float`
- airflow/metrics/statsd_logger.py:117:16: PYI041 Use `float` instead of `int | float`
+ airflow/metrics/statsd_logger.py:117:16: PYI041 [*] Use `float` instead of `int | float`
+ airflow/policies.py:109:54: PYI041 [*] Use `float` instead of `int | float`
+ airflow/serialization/helpers.py:28:65: PYI041 [*] Use `float` instead of `int | float`
+ airflow/serialization/serde.py:58:5: PYI041 [*] Use `float` instead of `int | float`
+ airflow/utils/log/colored_log.py:60:33: PYI041 [*] Use `float` instead of `int | float`
- airflow/utils/timezone.py:240:26: PYI041 Use `float` instead of `int | float`
+ airflow/utils/timezone.py:240:26: PYI041 [*] Use `float` instead of `int | float`
- airflow/utils/timezone.py:305:16: PYI041 Use `float` instead of `int | float`
+ airflow/utils/timezone.py:305:16: PYI041 [*] Use `float` instead of `int | float`
... 56 additional changes omitted for project

apache/superset (+11 -0 violations, +8 -0 fixes)

ruff check --no-cache --exit-zero --ignore RUF9 --output-format concise --preview --select ALL

+ superset/connectors/sqla/models.py:1673:10: PYI041 [*] Use `float` instead of `int | float`
- superset/daos/query.py:68:52: PYI041 Use `float` instead of `int | float`
+ superset/daos/query.py:68:52: PYI041 [*] Use `float` instead of `int | float`
+ superset/db_engine_specs/base.py:875:10: PYI041 [*] Use `float` instead of `int | float`
+ superset/distributed_lock/utils.py:31:15: PYI041 [*] Use `float` instead of `int | float`
+ superset/models/helpers.py:900:10: PYI041 [*] Use `float` instead of `int | float`
+ superset/superset_typing.py:105:15: PYI041 [*] Use `float` instead of `int | float`
- superset/utils/cache.py:150:14: PYI041 Use `float` instead of `int | float`
+ superset/utils/cache.py:150:14: PYI041 [*] Use `float` instead of `int | float`
- superset/utils/core.py:349:24: PYI041 Use `float` instead of `int | float`
... 9 additional changes omitted for project

bokeh/bokeh (+2 -0 violations, +0 -0 fixes)

ruff check --no-cache --exit-zero --ignore RUF9 --output-format concise --preview --select ALL

+ src/bokeh/core/property/numeric.py:53:24: PYI041 [*] Use `float` instead of `int | float`
+ tests/support/util/compare.py:50:18: PYI041 [*] Use `float` instead of `int | float`

latchbio/latch (+7 -0 violations, +0 -0 fixes)

ruff check --no-cache --exit-zero --ignore RUF9 --output-format concise --preview

+ src/latch/registry/types.py:37:43: PYI041 [*] Use `float` instead of `int | float`
+ src/latch/types/json.py:11:24: PYI041 [*] Use `float` instead of `int | float`
+ src/latch/types/metadata.py:418:28: PYI041 [*] Use `float` instead of `int | float`
+ src/latch_cli/snakemake/config/utils.py:12:24: PYI041 [*] Use `float` instead of `int | float`
+ src/latch_cli/snakemake/config/utils.py:196:50: PYI041 [*] Use `float` instead of `int | float`
+ src/latch_sdk_gql/__init__.py:14:24: PYI041 [*] Use `float` instead of `int | float`
+ src/latch_sdk_gql/utils.py:37:28: PYI041 [*] Use `float` instead of `int | float`

python/typeshed (+3 -5 violations, +0 -0 fixes)

ruff check --no-cache --exit-zero --ignore RUF9 --output-format concise --preview --select E,F,FA,I,PYI,RUF,UP,W

+ stdlib/marshal.pyi:12:5: PYI041 Use `complex` instead of `int | float | complex`
- stdlib/random.pyi:45:31: PYI041 Use `float` instead of `int | float`
- stdlib/random.pyi:52:27: PYI041 Use `float` instead of `int | float`
- stdlib/statistics.pyi:160:15: PYI041 Use `float` instead of `int | float`
- stdlib/turtle.pyi:443:16: PYI041 Use `float` instead of `int | float`
- stdlib/turtle.pyi:444:17: PYI041 Use `float` instead of `int | float`
+ stdlib/xmlrpc/client.pyi:17:5: PYI041 Use `float` instead of `int | float`
+ stubs/seaborn/seaborn/utils.pyi:43:5: PYI041 Use `complex` instead of `float | complex`

rotki/rotki (+1 -0 violations, +0 -0 fixes)

ruff check --no-cache --exit-zero --ignore RUF9 --output-format concise --preview

+ rotkehlchen/fval.py:8:27: PYI041 [*] Use `float` instead of `int | float`

zulip/zulip (+4 -0 violations, +0 -0 fixes)

ruff check --no-cache --exit-zero --ignore RUF9 --output-format concise --preview --select ALL

+ zerver/lib/data_types.py:116:28: PYI041 [*] Use `float` instead of `int | float`
+ zerver/lib/drafts.py:33:16: PYI041 [*] Use `float` instead of `int | float`
+ zerver/openapi/markdown_extension.py:257:64: PYI041 [*] Use `float` instead of `int | float`
+ zilencer/views.py:588:16: PYI041 [*] Use `float` instead of `int | float`

python-trio/trio (+0 -0 violations, +0 -0 fixes)

ruff check --no-cache --exit-zero --ignore RUF9 --output-format concise --preview


pytest-dev/pytest (+1 -0 violations, +0 -0 fixes)

ruff check --no-cache --exit-zero --ignore RUF9 --output-format concise --preview

+ src/_pytest/mark/structures.py:472:27: PYI041 [*] Use `float` instead of `int | float`

Changes by rule (1 rules affected)

code total + violation - violation + fix - fix
PYI041 134 63 5 66 0

@MichaReiser
Copy link
Member

Note for myself, merge #14273 after this PR lands

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

Successfully merging this pull request may close these issues.

2 participants