general_purpose_tools.py module

read_jsonstring_from_file(path_to_file, mode='r', method='readlines', decode_escape_char=False)

Safely reads JSON string from desired file into JSON dict

Parameters:
  • path_to_file (str) – pth to loaded file

  • mode (str) – read mode

  • decode_escape_char (bool) – should double escape be repalced by single ?

  • method (str) –

Returns:

read json string

Return type:

str

check_candidates(candidates)

Checks if items / candidates are of desired type and if they are not an empty collection

Parameters:

candidates (list or tuple or np.ndarray) – checked variants

Return type:

list

is_valid_ksuid(id_)

Checks if input value is a valid Ksuid string

Parameters:
  • id (str) – checked string

  • id_ (str) –

Returns:

True if string is a valid ksuid otherwise False

Return type:

bool

deepcopy_args(*args)

Helper function to deepcopy request body items before request. Requests are now asynchronous by default and not copying those values could yield strange results

Parameters:

args (list) – lsit of args to be copied

Returns:

list of copied args

Return type:

list