util

aitoolbox.utils.util.function_exists(object_to_check, fn_name)[source]

Check if function exists in the object

Parameters
  • object_to_check – object to be searched for the existence of the function

  • fn_name (str) – name of the function

Returns

if function is present in the provided object

Return type

bool

aitoolbox.utils.util.copy_function(fn)[source]

Deep copy a function

Based on http://stackoverflow.com/a/6528148/190597 (Glenn Maynard)

Parameters

fn (callable) – original function

Returns

copy of the provided function

Return type

callable

aitoolbox.utils.util.is_empty_function(fn)[source]

Returns true if f is an empty function

Taken from StackOverflow:

https://stackoverflow.com/a/58973125

Parameters

fn – function to be evaluated if it is empty or not

Returns

true if provided function is empty, otherwise false

Return type

bool

aitoolbox.utils.util.flatten_list_of_lists(nested_list)[source]

Flatten the nested list of lists

Parameters

nested_list (list) – nested list of lists to be flattened

Returns

flattened list

Return type

list or None