-
Notifications
You must be signed in to change notification settings - Fork 169
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Shrink TypedDicts by looking for fields that are present in all the TypedDicts and fields that are present only in some. When all fields are optional, generate a non-total TypedDict class stub. When there are both required and optional fields, generate a total base class and a non-total subclass. Design choices: + If a key has different value types in the traced types, then we shrink those types to get its value type. This should not lead to large types because we shrink large union types to Any. + If the resulting TypedDict is larger than max_typed_dict_size, then fall back to `Dict[str, ...]`. However, preserve any nested anonymous TypedDicts. + Represent required and optional fields as nested TypedDicts. + Add `types_equal` to allow equality for `List[TypedDicts(...)]` on 3.6. Co-authored-by: Pradeep Kumar Srinivasan <pradeepkumars@fb.com>
- Loading branch information
Showing
12 changed files
with
682 additions
and
201 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.