<#3123 Fix dict annotations> Pull request opened b...
# flyte-github
c
#3123 Fix dict annotations Pull request opened by wild-endeavor Tracking issue Internal ticket only. Why are the changes needed? Customer reported issue with internal model registry. The issue though is that annotations don't work well with dictionary return types. What changes were proposed in this pull request? Most of the changes here are in the dict transformer. • The
extract_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/flytekit