Latest Results
fix(parser): render non-finite values structurally (#3770)
* fix(parser): use AST resolution for non-finite math imports
Previously, add_math_imports_for_non_finite_literals used a regex scan over
the entire module body. This caused false-positive 'from math import inf, nan'
injections whenever words like 'inf' or 'nan' appeared in comments, docstrings,
or string field literals, resulting in unused import lint errors (F401).
Additionally, if 'math.inf' or 'math.nan' was already partially imported,
the previous string check would insert duplicate import statements.
This patch updates non-finite literal resolution to parse the AST and inspect
loaded identifier references and existing import bindings, ensuring clean
and accurate import injection after headers and future imports.
### Tests
- Added tests/parser/test_math_imports.py covering real literals, strings/comments/docstrings exclusion, store context exclusion, and existing import deduplication.
- Verified existing test suite in tests/test_types.py.
* Fix non-finite import edge cases
* Clarify pattern bindings for CodeQL
* Use builtin formatter in XML Schema regression
* Fix remaining non-finite import edge cases
* Narrow augmented assignment targets
* Split consecutive type alias chunks
* Render non-finite values structurally
* Fix structured literal imports
* Preserve non-finite conversion compatibility
---------
Co-authored-by: Koudai Aono <koxudaxi@gmail.com> Latest Branches
+30%
docs/release-benchmark-0.74.0 -11%
-1%
dependabot/pip/types-setuptools-gte-67.6.0.5-and-lt-85 © 2026 CodSpeed Technology