Skip to content

Remove float for unnecessary-type-conversion warning to account for int - #4553

Closed
kakolla wants to merge 1 commit into
facebook:mainfrom
kakolla:main
Closed

Remove float for unnecessary-type-conversion warning to account for int#4553
kakolla wants to merge 1 commit into
facebook:mainfrom
kakolla:main

Conversation

@kakolla

@kakolla kakolla commented Aug 15, 2026

Copy link
Copy Markdown
Contributor

Summary

As @pdhall99 found, pyrefly reports a 'unnecessary-type-conversion' warning for running a float() conversion, even though an int can be passed without runtime conversion which makes float() valid under python's numeric tower rule.

Fixes #4524

Test Plan

$ cargo test
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s

$ cargo test test_float_to_float_ok
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 32 filtered out; finished in 0.00s

$ python3 test.py --no-test --no-tensor-shapes --no-conformance --no-jsonschema
passed with 1 warning unrelated to this change

@meta-codesync

meta-codesync Bot commented Aug 15, 2026

Copy link
Copy Markdown
Contributor

This pull request has been imported. If you are a Meta employee, you can view this in D116149431. (Because this pull request was imported automatically, there will not be any future comments.)

@github-actions

Copy link
Copy Markdown

Diff from mypy_primer, showing the effect of this PR on open source code:

============================================================
SUMMARY
============================================================
Total: +0 new errors, -281 fixed errors

Projects with changes (35):
  pip: +0 -1
  cloud-init: +0 -5
  openlibrary: +0 -1
  egglog-python: +0 -2
  ppb-vector: +0 -1
  bokeh: +0 -4
  spark: +0 -81
  cwltool: +0 -1
  prefect: +0 -3
  colour: +0 -1
  urllib3: +0 -1
  scikit-learn: +0 -8
  freqtrade: +0 -13
  yarl: +0 -1
  apprise: +0 -16
  psycopg: +0 -1
  starlette: +0 -1
  aiohttp: +0 -2
  vision: +0 -31
  zulip: +0 -11
  sockeye: +0 -4
  anyio: +0 -1
  Tanjun: +0 -3
  ignite: +0 -3
  hydpy: +0 -3
  pandas: +0 -4
  dd-trace-py: +0 -2
  core: +0 -41
  trio: +0 -4
  paasta: +0 -5
  spack: +0 -2
  kornia: +0 -9
  discord.py: +0 -1
  optuna: +0 -13
  graphql-core: +0 -1
============================================================

FULL DIFF DETAILS
------------------------------------------------------------

pip (https://github.com/pypa/pip)
- ERROR src/pip/_vendor/urllib3/util/retry.py:326:21-67: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]

cloud-init (https://github.com/canonical/cloud-init)
- ERROR cloudinit/analyze/dump.py:58:17-28: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]
- ERROR cloudinit/analyze/show.py:259:37-50: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]
- ERROR cloudinit/sources/helpers/azure.py:61:29-37: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]
- ERROR cloudinit/url_helper.py:399:28-67: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]
- ERROR tests/unittests/test_util.py:1580:61-66: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]

openlibrary (https://github.com/internetarchive/openlibrary)
- ERROR openlibrary/coverstore/code.py:532:47-57: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]

egglog-python (https://github.com/egraphs-good/egglog-python)
- ERROR python/tests/__snapshots__/test_array_api/test_jit[lda][code].py:28:44-53: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]
- ERROR python/tests/__snapshots__/test_array_api/test_jit[lda][code].py:52:31-38: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]

ppb-vector (https://github.com/ppb/ppb-vector)
- ERROR ppb_vector/__init__.py:472:62-71: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]

bokeh (https://github.com/bokeh/bokeh)
- ERROR src/bokeh/colors/color.py:158:44-51: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]
- ERROR src/bokeh/colors/color.py:158:62-69: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]
- ERROR src/bokeh/colors/color.py:158:80-87: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]
- ERROR src/bokeh/colors/color.py:518:44-52: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]

spark (https://github.com/apache/spark)
- ERROR python/pyspark/ml/stat.py:263:24-27: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]
- ERROR python/pyspark/mllib/classification.py:400:22-28: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]
- ERROR python/pyspark/mllib/classification.py:401:22-41: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]
- ERROR python/pyspark/mllib/classification.py:403:22-32: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]
- ERROR python/pyspark/mllib/classification.py:407:22-38: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]
- ERROR python/pyspark/mllib/classification.py:503:22-32: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]
- ERROR python/pyspark/mllib/classification.py:507:22-33: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]
- ERROR python/pyspark/mllib/classification.py:710:22-28: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]
- ERROR python/pyspark/mllib/classification.py:711:22-32: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]
- ERROR python/pyspark/mllib/classification.py:712:22-41: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]
- ERROR python/pyspark/mllib/classification.py:717:22-38: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]
- ERROR python/pyspark/mllib/clustering.py:966:28-41: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]
- ERROR python/pyspark/mllib/evaluation.py:331:44-51: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]
- ERROR python/pyspark/mllib/evaluation.py:338:41-48: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]
- ERROR python/pyspark/mllib/evaluation.py:594:48-55: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]
- ERROR python/pyspark/mllib/evaluation.py:604:45-52: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]
- ERROR python/pyspark/mllib/evaluation.py:614:48-55: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]
- ERROR python/pyspark/mllib/feature.py:117:23-26: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]
- ERROR python/pyspark/mllib/feature.py:461:32-44: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]
- ERROR python/pyspark/mllib/feature.py:470:25-30: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]
- ERROR python/pyspark/mllib/feature.py:479:25-30: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]
- ERROR python/pyspark/mllib/feature.py:488:25-30: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]
- ERROR python/pyspark/mllib/feature.py:998:18-37: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]
- ERROR python/pyspark/mllib/fpm.py:101:64-76: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]
- ERROR python/pyspark/mllib/linalg/distributed.py:321:83-94: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]
- ERROR python/pyspark/mllib/linalg/distributed.py:429:93-100: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]
- ERROR python/pyspark/mllib/linalg/distributed.py:862:93-100: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]
- ERROR python/pyspark/mllib/linalg/distributed.py:911:27-34: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]
- ERROR python/pyspark/mllib/random.py:195:43-49: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]
- ERROR python/pyspark/mllib/random.py:195:56-61: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]
- ERROR python/pyspark/mllib/random.py:243:58-64: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]
- ERROR python/pyspark/mllib/random.py:290:62-68: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]
- ERROR python/pyspark/mllib/random.py:344:39-46: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]
- ERROR python/pyspark/mllib/random.py:344:53-60: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]
- ERROR python/pyspark/mllib/random.py:498:18-24: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]
- ERROR python/pyspark/mllib/random.py:499:18-23: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]
- ERROR python/pyspark/mllib/random.py:557:47-53: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]
- ERROR python/pyspark/mllib/random.py:611:51-57: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]
- ERROR python/pyspark/mllib/random.py:672:18-25: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]
- ERROR python/pyspark/mllib/random.py:673:18-25: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]
- ERROR python/pyspark/mllib/recommendation.py:51:65-78: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]
- ERROR python/pyspark/mllib/regression.py:87:27-34: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]
- ERROR python/pyspark/mllib/regression.py:116:32-43: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]
- ERROR python/pyspark/mllib/regression.py:366:22-28: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]
- ERROR python/pyspark/mllib/regression.py:367:22-41: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]
- ERROR python/pyspark/mllib/regression.py:369:22-32: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]
- ERROR python/pyspark/mllib/regression.py:373:22-38: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]
- ERROR python/pyspark/mllib/regression.py:544:22-28: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]
- ERROR python/pyspark/mllib/regression.py:545:22-32: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]
- ERROR python/pyspark/mllib/regression.py:546:22-41: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]
- ERROR python/pyspark/mllib/regression.py:550:22-38: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]
- ERROR python/pyspark/mllib/regression.py:725:22-28: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]
- ERROR python/pyspark/mllib/regression.py:726:22-32: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]
- ERROR python/pyspark/mllib/regression.py:727:22-41: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]
- ERROR python/pyspark/mllib/regression.py:731:22-38: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]
- ERROR python/pyspark/mllib/stat/_statistics.py:376:28-35: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]
- ERROR python/pyspark/mllib/util.py:597:25-33: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]
- ERROR python/pyspark/mllib/util.py:598:23-29: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]
- ERROR python/pyspark/mllib/util.py:599:27-32: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]
- ERROR python/pyspark/mllib/util.py:603:22-33: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]
- ERROR python/pyspark/mllib/util.py:609:22-27: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]
- ERROR python/pyspark/mllib/util.py:631:18-23: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]
- ERROR python/pyspark/mllib/util.py:633:18-29: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]
- ERROR python/pyspark/resource/requests.py:410:29-37: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]
- ERROR python/pyspark/resource/requests.py:484:69-79: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]
- ERROR python/pyspark/resource/requests.py:511:57-65: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]
- ERROR python/pyspark/resource/requests.py:536:75-83: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]
- ERROR python/pyspark/sql/classic/dataframe.py:711:33-36: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]
- ERROR python/pyspark/sql/connect/dataframe.py:1842:47-50: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]
- ERROR python/pyspark/sql/connect/plan.py:2071:42-45: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]
- ERROR python/pyspark/sql/session.py:1211:46-61: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]
- ERROR python/pyspark/sql/tests/pandas/helper/helper_pandas_transform_with_state.py:2027:37-46: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]
- ERROR python/pyspark/sql/tests/pandas/helper/helper_pandas_transform_with_state.py:2039:37-46: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]
- ERROR python/pyspark/sql/tests/pandas/helper/helper_pandas_transform_with_state.py:2107:34-43: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]
- ERROR python/pyspark/sql/tests/pandas/helper/helper_pandas_transform_with_state.py:2119:34-43: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]
- ERROR python/pyspark/sql/tests/pandas/test_pipelined_udf.py:202:25-35: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]
- ERROR python/pyspark/sql/tests/test_types.py:2406:55-60: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]
- ERROR python/pyspark/sql/tests/test_types.py:2407:55-61: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]
- ERROR python/pyspark/sql/utils.py:487:26-33: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]
- ERROR python/pyspark/sql/utils.py:488:22-28: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]
- ERROR python/pyspark/sql/utils.py:488:36-43: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]

cwltool (https://github.com/common-workflow-language/cwltool)
- ERROR cwltool/main.py:690:78-94: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]

prefect (https://github.com/PrefectHQ/prefect)
- ERROR src/prefect/testing/fixtures.py:226:28-46: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]
- ERROR src/prefect/utilities/math.py:73:21-34: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]
- ERROR src/prefect/utilities/math.py:73:42-55: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]

colour (https://github.com/colour-science/colour)
- ERROR colour/phenomena/sky/wilkie2021.py:927:23-33: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]

urllib3 (https://github.com/urllib3/urllib3)
- ERROR src/urllib3/util/retry.py:327:21-67: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]

scikit-learn (https://github.com/scikit-learn/scikit-learn)
- ERROR sklearn/linear_model/_ridge.py:2296:37-44: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]
- ERROR sklearn/linear_model/tests/test_logistic.py:237:21-86: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]
- ERROR sklearn/manifold/tests/test_t_sne.py:748:35-55: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]
- ERROR sklearn/metrics/_classification.py:4006:17-48: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]
- ERROR sklearn/metrics/_ranking.py:261:21-74: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]
- ERROR sklearn/metrics/tests/test_classification.py:2108:37-52: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]
- ERROR sklearn/tests/test_discriminant_analysis.py:211:23-222:6: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]
- ERROR sklearn/utils/tests/test_missing.py:12:15-23: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]

freqtrade (https://github.com/freqtrade/freqtrade)
- ERROR freqtrade/data/btanalysis/trade_parallelism.py:111:31-46: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]
- ERROR freqtrade/freqtradebot.py:2649:43-57: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]
- ERROR freqtrade/persistence/trade_model.py:860:29-77: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]
- ERROR freqtrade/persistence/trade_model.py:862:29-77: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]
- ERROR freqtrade/persistence/trade_model.py:907:21-37: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]
- ERROR freqtrade/persistence/trade_model.py:907:45-76: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]
- ERROR freqtrade/persistence/trade_model.py:1244:25-47: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]
- ERROR freqtrade/persistence/trade_model.py:1245:32-44: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]
- ERROR freqtrade/persistence/trade_model.py:1336:55-78: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]
- ERROR freqtrade/resolvers/strategy_resolver.py:143:38-57: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]
- ERROR freqtrade/rpc/fiat_convert.py:110:25-40: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]
- ERROR freqtrade/rpc/fiat_convert.py:112:21-36: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]
- ERROR freqtrade/rpc/fiat_convert.py:112:44-51: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]

yarl (https://github.com/aio-libs/yarl)
- ERROR yarl/_query.py:36:25-28: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]

apprise (https://github.com/caronc/apprise)
- ERROR apprise/plugins/irc/base.py:221:20-53: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]
- ERROR apprise/plugins/irc/base.py:335:43-69: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]
- ERROR apprise/plugins/irc/client.py:243:44-53: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]
- ERROR apprise/plugins/irc/client.py:277:44-53: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]
- ERROR apprise/plugins/irc/client.py:309:44-53: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]
- ERROR apprise/plugins/irc/client.py:324:44-53: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]
- ERROR apprise/plugins/irc/client.py:337:44-53: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]
- ERROR apprise/plugins/irc/client.py:348:44-53: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]
- ERROR apprise/plugins/xmpp/adapter.py:204:41-57: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]
- ERROR apprise/plugins/xmpp/adapter.py:420:38-47: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]
- ERROR apprise/utils/socket.py:121:34-45: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]
- ERROR apprise/utils/socket.py:125:31-39: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]
- ERROR apprise/utils/socket.py:191:54-63: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]
- ERROR apprise/utils/socket.py:210:54-63: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]
- ERROR apprise/utils/socket.py:447:61-70: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]
- ERROR apprise/utils/socket.py:606:65-74: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]

psycopg (https://github.com/psycopg/psycopg)
- ERROR tests/types/test_numeric.py:603:13-19: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]

starlette (https://github.com/encode/starlette)
- ERROR starlette/convertors.py:62:22-29: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]

aiohttp (https://github.com/aio-libs/aiohttp)
- ERROR aiohttp/web_protocol.py:263:37-53: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]
- ERROR aiohttp/web_protocol.py:276:49-73: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]

vision (https://github.com/pytorch/vision)
- ERROR torchvision/models/densenet.py:44:31-42: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]
- ERROR torchvision/models/swin_transformer.py:206:64-72: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]
- ERROR torchvision/models/swin_transformer.py:206:107-112: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]
- ERROR torchvision/models/video/swin_transformer.py:108:60-68: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]
- ERROR torchvision/models/video/swin_transformer.py:108:103-108: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]
- ERROR torchvision/transforms/_functional_tensor.py:259:18-25: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]
- ERROR torchvision/transforms/autoaugment.py:267:30-33: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]
- ERROR torchvision/transforms/autoaugment.py:352:30-33: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]
- ERROR torchvision/transforms/autoaugment.py:438:30-33: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]
- ERROR torchvision/transforms/autoaugment.py:558:30-33: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]
- ERROR torchvision/transforms/transforms.py:1360:52-64: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]
- ERROR torchvision/transforms/transforms.py:1360:71-83: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]
- ERROR torchvision/transforms/transforms.py:1493:52-64: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]
- ERROR torchvision/transforms/transforms.py:1493:71-83: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]
- ERROR torchvision/transforms/transforms.py:1495:27-55: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]
- ERROR torchvision/transforms/transforms.py:1496:27-55: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]
- ERROR torchvision/transforms/transforms.py:2088:27-34: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]
- ERROR torchvision/transforms/transforms.py:2088:41-48: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]
- ERROR torchvision/transforms/transforms.py:2104:27-34: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]
- ERROR torchvision/transforms/transforms.py:2104:41-48: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]
- ERROR torchvision/transforms/v2/_augment.py:146:27-34: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]
- ERROR torchvision/transforms/v2/_augment.py:314:29-68: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]
- ERROR torchvision/transforms/v2/_color.py:133:27-30: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]
- ERROR torchvision/transforms/v2/_color.py:140:66-76: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]
- ERROR torchvision/transforms/v2/_color.py:140:83-93: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]
- ERROR torchvision/transforms/v2/_geometry.py:748:27-54: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]
- ERROR torchvision/transforms/v2/_geometry.py:749:27-55: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]
- ERROR torchvision/transforms/v2/_utils.py:60:22-25: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]
- ERROR torchvision/transforms/v2/functional/_color.py:93:18-25: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]
- ERROR torchvision/transforms/v2/functional/_geometry.py:702:28-31: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]
- ERROR torchvision/transforms/v2/functional/_geometry.py:963:25-28: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]

zulip (https://github.com/zulip/zulip)
- ERROR zerver/migrations/0595_add_realmexport_table_and_backfill.py:15:40-51: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]
- ERROR zerver/data_import/import_util.py:880:16-44: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]
- ERROR zerver/data_import/mattermost.py:66:16-44: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]
- ERROR zerver/data_import/microsoft_teams.py:157:31-59: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]
- ERROR zerver/data_import/microsoft_teams.py:521:36-64: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]
- ERROR zerver/data_import/microsoft_teams.py:829:16-44: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]
- ERROR zerver/data_import/slack.py:168:16-44: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]
- ERROR zerver/lib/timestamp.py:52:40-51: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]
- ERROR zerver/tests/test_microsoft_teams_importer.py:560:32-60: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]
- ERROR zerver/tests/test_slack_importer.py:424:21-49: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]
- ERROR zerver/tests/test_slack_importer.py:2198:21-49: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]

sockeye (https://github.com/awslabs/sockeye)
- ERROR sockeye/inference.py:1299:43-71: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]
- ERROR sockeye/utils.py:779:36-55: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]
- ERROR sockeye/utils.py:783:36-58: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]
- ERROR sockeye/utils.py:786:55-73: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]

anyio (https://github.com/agronholm/anyio)
- ERROR src/anyio/_backends/_asyncio.py:672:31-38: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]

Tanjun (https://github.com/FasterSpeeding/Tanjun)
- ERROR tanjun/clients.py:1564:39-45: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]
- ERROR tanjun/commands/slash.py:2431:28-39: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]
- ERROR tanjun/commands/slash.py:2432:28-39: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]

ignite (https://github.com/pytorch/ignite)
- ERROR ignite/metrics/nlp/rouge.py:177:46-84: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]
- ERROR ignite/metrics/nlp/rouge.py:178:46-81: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]
- ERROR ignite/metrics/nlp/rouge.py:179:46-83: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]

hydpy (https://github.com/hydpy-dev/hydpy)
- ERROR hydpy/auxs/iuhtools.py:68:30-37: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]
- ERROR hydpy/models/arma/arma_control.py:269:36-39: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]
- ERROR hydpy/models/arma/arma_control.py:270:36-39: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]

pandas (https://github.com/pandas-dev/pandas)
- ERROR pandas/core/dtypes/cast.py:179:22-29: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]
- ERROR pandas/io/excel/_base.py:1412:24-29: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]
- ERROR pandas/io/excel/_pyxlsb.py:114:29-37: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]
- ERROR pandas/io/stata.py:755:60-67: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]

dd-trace-py (https://github.com/DataDog/dd-trace-py)
- ERROR ddtrace/_trace/sampler.py:46:33-46: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]
- ERROR ddtrace/_trace/sampling_rule.py:60:51-64: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]

core (https://github.com/home-assistant/core)
- ERROR homeassistant/components/alexa/handlers.py:662:19-57: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]
- ERROR homeassistant/components/anglian_water/coordinator.py:175:38-73: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]
- ERROR homeassistant/components/daikin/climate.py:180:27-47: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]
- ERROR homeassistant/components/denonavr/media_player.py:514:29-50: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]
- ERROR homeassistant/components/device_tracker/legacy.py:916:33-41: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]
- ERROR homeassistant/components/device_tracker/legacy.py:916:48-56: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]
- ERROR homeassistant/components/harmony/data.py:236:47-59: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]
- ERROR homeassistant/components/homeworks/light.py:101:18-43: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]
- ERROR homeassistant/components/hue/v2/helpers.py:10:27-53: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]
- ERROR homeassistant/components/influxdb/__init__.py:240:40-77: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]
- ERROR homeassistant/components/input_number/__init__.py:280:26-33: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]
- ERROR homeassistant/components/isy994/helpers.py:453:27-34: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]
- ERROR homeassistant/components/isy994/helpers.py:455:39-46: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]
- ERROR homeassistant/components/isy994/helpers.py:457:27-34: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]
- ERROR homeassistant/components/lg_netcast/media_player.py:251:38-52: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]
- ERROR homeassistant/components/lutron/light.py:48:17-38: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]
- ERROR homeassistant/components/midea/climate.py:576:25-43: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]
- ERROR homeassistant/components/osoenergy/water_heater.py:166:41-55: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]
- ERROR homeassistant/components/overkiz/climate/hitachi_air_to_water_heating_zone.py:143:56-69: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]
- ERROR homeassistant/components/russound_rio/number.py:111:21-67: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]
- ERROR homeassistant/components/sleepiq/number.py:259:40-87: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]
- ERROR homeassistant/components/srp_energy/coordinator.py:68:24-34: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]
- ERROR homeassistant/components/srp_energy/coordinator.py:69:25-35: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]
- ERROR homeassistant/components/srp_energy/coordinator.py:144:41-51: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]
- ERROR homeassistant/components/tomorrowio/sensor.py:346:38-45: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]
- ERROR homeassistant/components/tomorrowio/sensor.py:348:23-30: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]
- ERROR homeassistant/components/unifi_access/coordinator.py:124:22-29: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]
- ERROR homeassistant/components/vallox/number.py:53:55-62: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]
- ERROR homeassistant/components/weather/__init__.py:577:38-51: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]
- ERROR homeassistant/components/weather/__init__.py:591:47-69: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]
- ERROR homeassistant/components/weather/__init__.py:607:36-47: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]
- ERROR homeassistant/components/weather/__init__.py:635:35-45: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]
- ERROR homeassistant/components/weather/__init__.py:654:42-59: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]
- ERROR homeassistant/components/weather/__init__.py:668:37-49: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]
- ERROR homeassistant/components/weather/__init__.py:684:37-49: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]
- ERROR homeassistant/components/weather/significant_change.py:55:21-80: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]
- ERROR homeassistant/components/wyoming/number.py:95:40-97:10: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]
- ERROR homeassistant/components/zabbix/__init__.py:155:40-77: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]
- ERROR homeassistant/helpers/json.py:49:21-26: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]
- ERROR homeassistant/util/color.py:644:17-44: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]
- ERROR homeassistant/util/dt.py:289:34-75: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]

trio (https://github.com/python-trio/trio)
- ERROR src/trio/_core/_mock_clock.py:97:31-41: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]
- ERROR src/trio/_core/_mock_clock.py:105:41-65: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]
- ERROR src/trio/_core/_run.py:825:35-49: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]
- ERROR src/trio/_core/_run.py:858:56-79: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]

paasta (https://github.com/yelp/paasta)
- ERROR paasta_tools/cleanup_kubernetes_jobs.py:260:18-34: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]
- ERROR paasta_tools/drain_lib.py:186:27-34: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]
- ERROR paasta_tools/drain_lib.py:188:32-44: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]
- ERROR paasta_tools/drain_lib.py:188:53-60: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]
- ERROR paasta_tools/metrics/metastatus_lib.py:317:30-37: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]

spack (https://github.com/spack/spack)
- ERROR lib/spack/spack/util/spack_yaml.py:108:21-26: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]
- ERROR lib/spack/spack/util/web.py:80:21-59: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]

kornia (https://github.com/kornia/kornia)
- ERROR kornia/augmentation/random_generator/_2d/cutmix.py:93:57-65: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]
- ERROR kornia/augmentation/random_generator/_2d/mixup.py:66:57-65: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]
- ERROR kornia/augmentation/random_generator/_2d/probability.py:55:31-39: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]
- ERROR kornia/color/rgb.py:112:48-59: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]
- ERROR kornia/enhance/threshold.py:132:28-36: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]
- ERROR kornia/enhance/threshold.py:133:28-36: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]
- ERROR kornia/feature/siftdesc.py:217:52-66: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]
- ERROR kornia/feature/siftdesc.py:377:67-81: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]
- ERROR kornia/metrics/pose.py:224:24-29: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]

discord.py (https://github.com/Rapptz/discord.py)
- ERROR discord/app_commands/checks.py:94:32-37: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]

optuna (https://github.com/optuna/optuna)
- ERROR optuna/distributions.py:157:30-36: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]
- ERROR optuna/distributions.py:159:25-30: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]
- ERROR optuna/distributions.py:160:26-32: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]
- ERROR optuna/distributions.py:184:34-64: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]
- ERROR optuna/study/_tell.py:64:18-21: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]
- ERROR optuna/study/_tell.py:165:24-31: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]
- ERROR optuna/testing/pytest_samplers.py:167:25-69: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]
- ERROR optuna/trial/_fixed.py:214:26-33: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]
- ERROR optuna/trial/_frozen.py:502:26-33: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]
- ERROR optuna/trial/_trial.py:487:26-33: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]
- ERROR optuna/trial/_trial.py:791:26-33: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]
- ERROR optuna/visualization/_parallel_coordinate.py:278:23-76: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]
- ERROR optuna/visualization/_utils.py:119:26-33: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]

graphql-core (https://github.com/graphql-python/graphql-core)
- ERROR src/graphql/type/scalars.py:360:17-24: Unnecessary `float()` call; argument is already of type `float` [unnecessary-type-conversion]

@grievejia grievejia left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Review automatically exported from Phabricator review in Meta.

@meta-codesync meta-codesync Bot closed this in 2b14e2b Aug 18, 2026
@meta-codesync meta-codesync Bot added the Merged label Aug 18, 2026
@meta-codesync

meta-codesync Bot commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

@kakolla merged this pull request in 2b14e2b.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Potential false-positive unnecessary-type-conversion for float annotations

3 participants