Misc. utilities for the CLI
Functions
|
Returns the config from a click context |
|
Returns a list of keys for the given enum. |
|
Returns a dict of enum members for the given enum. |
Returns a list of all available logging levels in string format |
|
|
If |
Returns the pipeline from a click context |
|
|
Returns True if the given class is an enum. |
|
Determines if the given |
|
Returns a list of labels from the given file, where each line is a label. |
|
Parses a string into an enum value. |
|
Click callback that parses a command line value into a logging level |
|
Decorator ensuring that a click.Context object is passed as the first argument to the decorated function |
Ensures the click.Context has |
|
|
Converts a string to a FileType enum member |
Removes keyword arguments that have a None value |
Classes
|
A specialization of the |
- 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