flytekit.Literal

class flytekit.Literal(scalar=None, collection=None, map=None, hash=None, metadata=None)[source]

Methods

Parameters:
  • scalar (Scalar | None)

  • collection (LiteralCollection | None)

  • map (LiteralMap | None)

  • hash (str | None)

  • metadata (Dict[str, str] | None)

classmethod from_flyte_idl(pb2_object)[source]
Parameters:

pb2_object (flyteidl.core.literals_pb2.Literal)

Return type:

Literal

serialize_to_string()
Return type:

str

set_metadata(metadata)[source]

Note: This is a mutation on the literal :param Dict[str, str] metadata: Metadata to be added

Parameters:

metadata (Dict[str, str])

short_string()
Return type:

Text

to_flyte_idl()[source]
Return type:

flyteidl.core.literals_pb2.Literal

verbose_string()
Return type:

Text

Attributes

collection

If not None, this value holds a collection of Literal values which can be further unpacked. :rtype: LiteralCollection

hash

If not None, this value holds a hash that represents the literal for caching purposes. :rtype: str

is_empty
map

If not None, this value holds a map of Literal values which can be further unpacked. :rtype: LiteralMap

metadata

This value holds metadata about the literal.

scalar

If not None, this value holds a scalar value which can be further unpacked. :rtype: Scalar

value

Returns one of the scalar, collection, or map properties based on which one is set. :rtype: T