Skip to content

Commit

Permalink
wip - Add support for univariate lists
Browse files Browse the repository at this point in the history
Signed-off-by: Eduardo Apolinario <eapolinario@users.noreply.github.com>
  • Loading branch information
eapolinario committed Feb 18, 2022
1 parent 2da76f3 commit adaa448
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion flytekit/core/type_engine.py
Expand Up @@ -803,7 +803,9 @@ def get_literal_type(self, t: Type[T]) -> Optional[LiteralType]:
def to_literal(self, ctx: FlyteContext, python_val: T, python_type: Type[T], expected: LiteralType) -> Literal:
t = self.get_sub_type(python_type)
lit_list = [TypeEngine.to_literal(ctx, x, t, expected.collection_type) for x in python_val] # type: ignore
return Literal(collection=LiteralCollection(literals=lit_list))
hash = "|".join([literal.hash for literal in lit_list if literal.hash])
print(f"hash={hash}")
return Literal(collection=LiteralCollection(literals=lit_list), hash=hash if hash != "|" else None)

def to_python_value(self, ctx: FlyteContext, lv: Literal, expected_python_type: Type[T]) -> typing.List[T]:
st = self.get_sub_type(expected_python_type)
Expand Down

0 comments on commit adaa448

Please sign in to comment.