cuddly-jelly-27016
02/10/2025, 11:14 PMextract_types_or_metadata function is inconsistent, returning different things in different scenarios - sometimes it would return annotations, sometimes it would return the key/value type of a dictionary. This has been changed to always return the latter, or an empty tuple () in the case of an untyped dictionary. In all cases now, the caller interprets the result as a tuple of key type,value type. Renaming function to just extract_types.
• the is_pickle function returned both a boolean, as well as types, but the latter isn't really necessary. Changing this to just return the pickle bool.
• dict_types is a function that was almost the same as extract_types_or_metadata, removing in favor of that one and manually extracting the annotation args where needed.
• Remove a duplicate test
How was this patch tested?
Setup process
Screenshots
Check all the applicable boxes
• I updated the documentation accordingly.
• All new and existing tests passed.
• All commits are signed-off.
Related PRs
Docs link
Summary by Bito
Enhanced DictTransformer implementation by refactoring type handling and simplifying type extraction functionality. The extract_types_or_metadata function has been renamed to extract_types, with improved type casting. Reorganized test structure by eliminating duplicate tests and properly relocating dictionary type extraction tests. Changes improve consistency in dictionary type handling and focus on type safety improvements.
Unit tests added: True
Estimated effort to review (1-5, lower is better): 2
flyteorg/flytekitcuddly-jelly-27016
02/10/2025, 11:14 PMcuddly-jelly-27016
02/11/2025, 12:35 AM