flytekit.core.utils
0.1.dev2192+g7c539c3.d20250403
flytekit.core.utils
Class
Description
AutoDeletingTempDir
Creates a posix safe tempdir which is auto deleted once out of scope.
ClassDecorator
Abstract class for class decorators.
Directory
timeit
A context manager and a decorator that measures the execution time of the wrapped code block or functions.
Property
Type
Description
TYPE_CHECKING
bool
def has_return_statement (
func: typing. Callable,
) -> bool
Parameter
Type
func
typing.Callable
def load_proto_from_file (
pb2_type,
path,
)
Parameter
Type
pb2_type
path
def str2bool (
value: typing. Optional[str],
) -> n: the boolean value
Convert a string to a boolean. This is useful for parsing environment variables.
Parameter
Type
value
typing.Optional[str]
def write_proto_to_file (
proto,
path,
)
Parameter
Type
proto
path
Creates a posix safe tempdir which is auto deleted once out of scope
class AutoDeletingTempDir (
working_dir_prefix,
tmp_dir,
cleanup,
)
Parameter
Type
working_dir_prefix
tmp_dir
cleanup
def get_named_tempfile (
name,
)
The list of absolute filepaths for all immediate sub-paths
:rtype: list[Text]
Property
Type
Description
name
:rtype: Text
Abstract class for class decorators.
We can attach config on the decorator class and use it in the upper level.
class ClassDecorator (
task_function,
kwargs,
)
If the decorator is called with arguments, func will be None.
If the decorator is called without arguments, func will be function to be decorated.
Parameter
Type
task_function
kwargs
**kwargs
Method
Description
execute()
This method will be called when the decorated function is called.
get_extra_config()
Get the config of the decorator.
def execute (
args,
kwargs,
)
This method will be called when the decorated function is called.
Parameter
Type
args
*args
kwargs
**kwargs
Get the config of the decorator.
Method
Description
list_dir()
The list of absolute filepaths for all immediate sub-paths.
The list of absolute filepaths for all immediate sub-paths
:rtype: list[Text]
Property
Type
Description
name
:rtype: Text
A context manager and a decorator that measures the execution time of the wrapped code block or functions.
It will append a timing information to TimeLineDeck. For instance:
@timeit(“Function description”)
def function()
with timeit(“Wrapped code block description”):
# your code
class timeit (
name: str,
)