Refactor(Optimizer): improve typing coverage of optimizer modules#7446
Merged
georgesittas merged 21 commits intotobymao:mainfrom Apr 6, 2026
Merged
Refactor(Optimizer): improve typing coverage of optimizer modules#7446georgesittas merged 21 commits intotobymao:mainfrom
georgesittas merged 21 commits intotobymao:mainfrom
Conversation
…alized`. the caller site is currently untypted anyway
… function body to avoid redundant/type unsafe double isinstance check
…y_integer_cast`. trying with overloads
georgesittas
reviewed
Apr 3, 2026
Contributor
Author
|
To clarify: the goal is to gradually add types, since
The latter will be revisited in the future, hopefully with the help of more context. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Details
WIP
This is a work in progress. But since those files are very untyped ATM, it's better to split up in various passes. This is the first one, focusing on public level and simplify module.
datetime import
I changed the
import datetimetofrom datetime import x, y, z. It's more concise when thedatetimeobject are needed, but most importantly it's much less confusing.Fault is on Python for sure for the API design, but since
datetimeis both a module and an object, anddatetime.datecan represent both a method and an object, IMO it's preferrable.Partial typing
I skipped various methods/functions (or partially typed them like
simplify_literals).This is intentionnal. ATM there's various untypable behaviors, like "unsafe" non-none checks on
Exprproperties/args.This would require changing the actual runtime behavior, which is out-of-scope here.