devops.utils.utils

Module defining utility functions for mstd checks.

Functions

check_key_sequence_ordered(key_sequence, line)

Check if keys in key_sequence appear in order on the given line.

find_indices(list_to_search, element)

Find all indices of an element in a list.

devops.utils.utils.find_indices(list_to_search, element)[source]

Find all indices of an element in a list.

Parameters:
  • list_to_search (list[Any]) – The list to search through.

  • element (Any) – The element to find in the list.

Returns:

list[int] – A list of indices where the element is found.

Return type:

list[int]

devops.utils.utils.check_key_sequence_ordered(key_sequence, line, key_delimiter=' ')[source]

Check if keys in key_sequence appear in order on the given line.

Parameters:
  • key_sequence (str) – The sequence of keys to check for order as a string.

  • line (str) – The line of text to check.

  • key_delimiter (str) – The delimiter used to find the keys.

Returns:

ResultType – Result of the check, Error if keys are out of order, Ok otherwise

Return type:

ResultType