Skip to content

Commit 88b11e7

Browse files
committed
comment: trim verbose EnumTransformer.to_literal note per review
The assert_type/serialize rationale already lives in the PR description, so the inline comment is now a single line. Signed-off-by: 1fanwang <1fannnw@gmail.com>
1 parent c2e0d84 commit 88b11e7

1 file changed

Lines changed: 1 addition & 2 deletions

File tree

‎flytekit/core/type_engine.py‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1081,8 +1081,7 @@ def get_literal_type(self, t: Type[T]) -> LiteralType:
10811081
def to_literal(
10821082
self, ctx: FlyteContext, python_val: Union[enum.Enum, str], python_type: Type[T], expected: LiteralType
10831083
) -> Literal:
1084-
# Accept a raw string matching one of the enum's values: assert_type already allows it (e.g. an enum
1085-
# default supplied as a string), so to_literal must too, else such a value type-checks but fails to serialize.
1084+
# Accept either an enum member or a raw string matching one of its values.
10861085
val = python_val.value if isinstance(python_val, enum.Enum) else python_val
10871086
if not isinstance(val, str):
10881087
raise TypeTransformerFailedError(f"Expected an enum or matching string, got {type(python_val)}")

0 commit comments

Comments
 (0)