Files
Charlie Marsh f31dd86f22 [ty] Reuse mapping value types when unpacking keyword arguments (#30638)
## Summary

When we check `f(**options)`, we infer the type of `options["timeout"]`
once per overload that accepts `timeout`. We now cache that type by
mapping type and key. If `__getitem__` recursively unpacks the same
mapping, we bypass the cache so return type inference can resolve the
cycle.

In Ansible’s AWS helper, 53,104 requests needed only 20 computations.
Cold checks used 17.64–17.71% fewer instructions for the collection’s
`plugins/module_utils` with `boto3-stubs` and 10.25–10.39% fewer for
Remotion’s Lambda Python package. [Ansible call
site](https://github.com/ansible-collections/amazon.aws/blob/49e74a059c3fb2f1edd4f6a40105e7e53400818f/plugins/module_utils/botocore.py#L181-L187),
[Remotion call
site](https://github.com/remotion-dev/remotion/blob/2c93495f062a688e9ccb6ee90b6d57560080571e/packages/lambda-python/remotion_lambda/remotionclient.py#L242-L267)

| Project | [Base
instructions](https://github.com/astral-sh/ruff/commit/a866aff503fd777156c1ae4eae318a3795fa09ec)
| [PR
instructions](https://github.com/astral-sh/ruff/commit/7b855a6f694e687f7902b27842bccc2fb3cfbef5)
| Change | Paired range |
| --- | ---: | ---: | ---: | ---: |
|
[Black](https://github.com/psf/black/tree/55996d1fb8342725c8a19b6023cd9439c3c1d6f7)
| 3,171,801,466 | 3,169,035,907.5 | -0.09% | -0.10% to -0.08% |
|
[discord.py](https://github.com/Rapptz/discord.py/tree/65232c38702be5844cf2ce865a4777eb1928b5d0)
| 8,250,616,901.5 | 8,177,924,067 | -0.88% | -1.03% to -0.73% |
| [Home
Assistant](https://github.com/home-assistant/core/tree/c19ae285ede74cd64c3045a3a4aa43290c224f1b)
| 159,266,177,927 | 159,028,883,587.5 | -0.15% | -0.15% to -0.15% |
|
[isort](https://github.com/pycqa/isort/tree/a514c71ed86c2216d0040c7d60e302ed76a4f7ab)
(inconclusive) | 1,864,065,239 | 1,855,375,386.5 | -0.47% | -0.49% to
-0.44% |
|
[Jinja](https://github.com/pallets/jinja/tree/5ef70112a1ff19c05324ff889dd30405b1002044)
| 1,943,162,825.5 | 1,938,087,991 | -0.26% | -0.35% to -0.17% |
|
[pandas](https://github.com/pandas-dev/pandas/tree/a0225b65720018f4654390bb16d254daa6ee5e54)
| 28,826,780,884 | 28,715,893,158.5 | -0.38% | -0.41% to -0.36% |
|
[pandas-stubs](https://github.com/pandas-dev/pandas-stubs/tree/8dd6d91b1c05b26e30f7ddbe3dc3d4042a92bdd6)
(inconclusive) | 2,970,521,765 | 2,974,646,132 | +0.14% | +0.08% to
+0.20% |
|
[Prefect](https://github.com/PrefectHQ/prefect/tree/a9452ac21852755311913cb27887b083b5007c03)
| 4,957,873,188 | 4,951,763,267 | -0.12% | -0.18% to -0.07% |
|
[PyTorch](https://github.com/pytorch/pytorch/tree/ab92945cea42e47ae398aead69af0872d340ea0f)
| 96,625,488,028 | 96,398,599,290.5 | -0.23% | -0.25% to -0.22% |
|
[HTTPX](https://github.com/encode/httpx/tree/b5addb64f0161ff6bfe94c124ef76f6a1fba5254)
(inconclusive) | 1,680,826,173 | 1,679,516,159 | -0.08% | -0.10% to
-0.06% |
|
[NumPy](https://github.com/numpy/numpy/tree/f9f1772ce010001208475f751d19253469788410)
(inconclusive) | 8,486,218,999 | 8,490,301,469 | +0.05% | +0.03% to
+0.06% |
|
[FastAPI](https://github.com/fastapi/fastapi/tree/7a0a3f0b286c6c865cf4398ea0e957a87b8bffa4)
| 3,008,918,366 | 2,998,116,989 | -0.36% | -0.44% to -0.28% |
|
[SQLAlchemy](https://github.com/sqlalchemy/sqlalchemy/tree/10f4d1e2d706a7722ca78e79ce05b00333a7aa5b)
(inconclusive) | 21,546,418,242 | 21,472,480,386 | -0.34% | -0.66% to
-0.03% |
|
[Rich](https://github.com/Textualize/rich/tree/9d8f9a372cc5916fd4781fec207ced7ddac2f08f)
(inconclusive) | 2,722,081,999 | 2,718,832,889.5 | -0.12% | -0.19% to
-0.05% |
|
[Django](https://github.com/django/django/tree/b501b8493f31cf8cba31211d59b3b78642b8cb02)
| 13,899,250,351 | 13,826,686,370.5 | -0.52% | -0.54% to -0.50% |
|
[SymPy](https://github.com/sympy/sympy/tree/85d3998a4517ffbc8a9709b8efa769bb417c174a)
| 46,173,892,849.5 | 46,042,223,842.5 | -0.29% | -0.32% to -0.25% |
| [OpenAI Python
SDK](https://github.com/openai/openai-python/tree/f6e8480f9a5b2a4d02b17a1da54a1e57964bc312)
| 16,012,979,988.5 | 15,976,893,887 | -0.23% | -0.23% to -0.22% |
|
[pytest](https://github.com/pytest-dev/pytest/tree/8b005ed7f972987033ec34dc1e68b0635fb8142b)
| 8,811,149,334.5 | 8,789,611,084 | -0.24% | -0.27% to -0.22% |
|
[aiohttp](https://github.com/aio-libs/aiohttp/tree/fe099491d275ef2c21bf683e024e34d51ac05d43)
| 4,173,979,600.5 | 4,161,474,785 | -0.30% | -0.31% to -0.29% |
|
[Ansible](https://github.com/ansible/ansible/tree/b4b2b1e82a535d27f902a71fc8396c3af138fca2)
| 14,451,498,108 | 14,390,757,714 | -0.42% | -0.43% to -0.41% |
|
[botocore](https://github.com/boto/botocore/tree/e250abbe956da791c16086575e6ddb1f2da81a78)
| 3,024,807,473.5 | 3,011,850,356 | -0.43% | -0.45% to -0.41% |
|
[Celery](https://github.com/celery/celery/tree/9c2f238334331db43f15956f131235fd3bb70fd1)
| 4,824,352,276 | 4,786,331,231 | -0.79% | -0.79% to -0.78% |
|
[Dask](https://github.com/dask/dask/tree/249a51a1db4261791b93b4ce04e67341729939c3)
| 34,989,387,306.5 | 34,844,208,801 | -0.41% | -0.42% to -0.41% |
|
[NetworkX](https://github.com/networkx/networkx/tree/6855cd586982cc2e4710b8eb87251ccf56674bf1)
| 15,751,466,639 | 15,718,820,318 | -0.21% | -0.21% to -0.20% |
|
[Pydantic](https://github.com/pydantic/pydantic/tree/560f0f96a37d6913afdfddb2de22030ef08e68c3)
| 13,065,115,493.5 | 13,057,222,765 | -0.06% | -0.08% to -0.04% |
|
[scikit-learn](https://github.com/scikit-learn/scikit-learn/tree/ee56c8b5d809dc7b970a140ed501269b63c69cf8)
| 66,934,132,757 | 66,184,416,440 | -1.12% | -1.19% to -1.05% |
|
[Scrapy](https://github.com/scrapy/scrapy/tree/e63a574c767d7a9438c21db158f605f1c44c6e6a)
| 8,982,113,758 | 8,952,424,478.5 | -0.33% | -0.34% to -0.32% |
|
[Transformers](https://github.com/huggingface/transformers/tree/3a134bc37f7c22c801b618e289b0255425f22647)
| 102,066,588,951 | 100,473,574,916.5 | -1.56% | -1.60% to -1.52% |
2026-11-20 16:01:05 -05:00
..