-
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.
Handle TypedDicts nested within generic types. (#162)
Fixes #159. Earlier, we didn't pass in `max_typed_dict_size` recursively for all calls to `get_type`. This meant that `[{"a": 1}]` would produce the TypedDict class name even when `max_typed_dict_size` was set to 0. And since we didn't gather class stubs from nested generic types, the class definition stub wouldn't show up either. * Pass `max_typed_dict_size` in all calls of `get_type`. * Gather class stubs recursively using a `TypeRewriter` visitor for parameter types, return types, and yield types. Add `rewrite_TypedDict` method to `TypeRewriter`. * Special-case `{}` so that we don't return an empty TypedDict regardless of `max_typed_dict_size`.
- Loading branch information
Showing
6 changed files
with
344 additions
and
59 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
Oops, something went wrong.