# watcherclient.common.utils module

class watcherclient.common.utils.HelpFormatter(prog, indent_increment=2, max_help_position=24, width=None, color=True)

  Bases: `HelpFormatter`

  start_section(heading)

watcherclient.common.utils.args_array_to_dict(kwargs, key_to_convert)

watcherclient.common.utils.args_array_to_patch(op, attributes, exclude_fields=[])

watcherclient.common.utils.common_filters(limit=None, sort_key=None, sort_dir=None, marker=None)

  Generate common filters for any list request.

  Parameters:

    - limit – maximum number of entities to return.

    - sort_key – field to use for sorting.

    - sort_dir – direction of sorting: ‘asc’ or ‘desc’.

    - marker – The last actionplan UUID of the previous page.

  Returns:

    list of string filters.

watcherclient.common.utils.common_params_for_list(args, fields, field_labels)

  Generate ‘params’ dict that is common for every ‘list’ command.

  Parameters:

    - args – arguments from command line.

    - fields – possible fields for sorting.

    - field_labels – possible field labels for sorting.

  Returns:

    a dict with params to pass to the client method.

watcherclient.common.utils.define_command(subparsers, command, callback, cmd_mapper)

  Define a command in the subparsers collection.

  Parameters:

    - subparsers – subparsers collection where the command will go

    - command – command name

    - callback – function that will be used to process the command

watcherclient.common.utils.define_commands_from_module(subparsers, command_module, cmd_mapper)

  Add do_ methods in a module and add as commands into a subparsers.

watcherclient.common.utils.import_versioned_module(version, submodule=None)

watcherclient.common.utils.is_uuid_like(val)

  Returns validation of a value as a UUID.

  For our purposes, a UUID is a canonical form string: aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa

watcherclient.common.utils.serialize_file_to_dict(filename)

watcherclient.common.utils.split_and_deserialize(string, exclude_fields=[])

  Split and try to JSON deserialize a string.

  Gets a string with the KEY=VALUE format, split it (using ‘=’ as the separator) and try to JSON deserialize the VALUE.

  Returns:

    A tuple of (key, value).

this page last updated: 2026-03-26 21:48:01

Except where otherwise noted, this document is licensed under Creative Commons Attribution 3.0 License. See all OpenStack Legal Documents.

found an error? report a bug