Change Set Computations

Module: ppc_robot_lib.utils.changes

class ItemAddition(insert_index, new_list_index)

Create new instance of ItemAddition(insert_index, new_list_index)

insert_index

Alias for field number 0

new_list_index

Alias for field number 1

class ItemDeletion(deletion_index)

Create new instance of ItemDeletion(deletion_index,)

deletion_index

Alias for field number 0

compute_list_changes(new_list, original_list)[source]

Computes a list of changes that has to be performed on original_list to transform it to new_list. Equivalence of items is determined using the == operator.

This method can be used on table headers to compute which columns needs to be removed and which needs to be added.

The operations must be performed in the following order:

  1. Perform all deletions in the given order.

  2. Add all columns in the given order.

Parameters:
  • new_list (list) – Desired state of the list.

  • original_list (list) – Original state of the list.

Return type:

tuple[list[ItemDeletion], list[ItemAddition]]

Returns:

Tuple containing (list_of_deletions, list_of_additions)

normalize_column_list(column_list)[source]

Normalizes the given list of columns. Performs the following operations:

  1. Converts columns specified by a list to tuples.

Parameters:

column_list (list[Any]) – Input column list, may be previously stored.

Returns:

Normalized column list.