NVIDIA Morpheus (24.06)
(Latest Version)

morpheus.cli.utils

Misc. utilities for the CLI

Functions

get_config_from_ctx(ctx) Returns the config from a click context
get_enum_keys(enum_class) Returns a list of keys for the given enum.
get_enum_members(enum_class) Returns a dict of enum members for the given enum.
get_log_levels() Returns a list of all available logging levels in string format
get_package_relative_file(filename) If filename is a relative path, and does not exist, attempt to locate the file relative to the directory of the morpheus package, if it exists return the abolute path of the file found.
get_pipeline_from_ctx(ctx) Returns the pipeline from a click context
is_enum(enum_class) Returns True if the given class is an enum.
is_pybind_enum(cls) Determines if the given cls is an enum.
load_labels_file(labels_file) Returns a list of labels from the given file, where each line is a label.
parse_enum(_, _2, value, enum_class[, ...]) Parses a string into an enum value.
parse_log_level(ctx, param, value) Click callback that parses a command line value into a logging level
prepare_command([parse_config]) Decorator ensuring that a click.Context object is passed as the first argument to the decorated function
show_defaults(f) Ensures the click.Context has show_defaults set to True.
str_to_file_type(file_type_str) Converts a string to a FileType enum member
without_empty_args(f) Removes keyword arguments that have a None value

Classes

MorpheusRelativePath(*args, **kwargs) A specialization of the click.Path class that falls back to using package relative paths if the file cannot be found.
get_config_from_ctx(ctx)[source]

Returns the config from a click context

get_enum_keys(enum_class)[source]

Returns a list of keys for the given enum.

get_enum_members(enum_class)[source]

Returns a dict of enum members for the given enum.

get_log_levels()[source]

Returns a list of all available logging levels in string format

get_package_relative_file(filename)[source]

If filename is a relative path, and does not exist, attempt to locate the file relative to the directory of the morpheus package, if it exists return the abolute path of the file found. Otherwise returns filename unchanged.

get_pipeline_from_ctx(ctx)[source]

Returns the pipeline from a click context

is_enum(enum_class)[source]

Returns True if the given class is an enum.

is_pybind_enum(cls)[source]

Determines if the given cls is an enum. C++ enums exposed via pybind11 do not inherit from Enum, but do expose the __members__ convention. https://docs.python.org/3.10/library/enum.html?highlight=__members__#iteration

load_labels_file(labels_file)[source]

Returns a list of labels from the given file, where each line is a label.

parse_enum(_, _2, value, enum_class, case_sensitive=True)[source]

Parses a string into an enum value.

parse_log_level(ctx, param, value)[source]

Click callback that parses a command line value into a logging level

prepare_command(parse_config=False)[source]

Decorator ensuring that a click.Context object is passed as the first argument to the decorated function

show_defaults(f)[source]

Ensures the click.Context has show_defaults set to True. (Seems like a bug currently)

str_to_file_type(file_type_str)[source]

Converts a string to a FileType enum member

without_empty_args(f)[source]

Removes keyword arguments that have a None value

Previous morpheus.cli.stage_registry.StageRegistry
Next morpheus.cli.utils.MorpheusRelativePath
© Copyright 2024, NVIDIA. Last updated on Jul 8, 2024.