The guidata.utils module provides various utility helper functions (pure python).

guidata.utils.min_equals_max(min, max)[source]

Return True if minimium value equals maximum value Return False if not, or if maximum or minimum value is not defined


A simple generator that takes a list and generates pairs [ (l[0],l[1]), ..., (l[n-2], l[n-1])]

guidata.utils.add_extension(item, value)[source]

Add extension to filename item: data item representing a file path value: possible value for data item

guidata.utils.bind(fct, value)[source]

Returns a callable representing the function ‘fct’ with it’s first argument bound to the value

if g = bind(f,1) and f is a function of x,y,z then g(y,z) will return f(1,y,z)


A decorator that traces function entry/exit used for debugging only


Convert string from file system charset to unicode


Convert UTF-8 string to Unicode


convert a unicode string to a byte string encoded for stdout output

guidata.utils.update_dataset(dest, source, visible_only=False)[source]

Update dest dataset items from source dataset

dest should inherit from DataSet, whereas source can be:
  • any Python object containing matching attribute names
  • or a dictionary with matching key names

For each DataSet item, the function will try to get the attribute of the same name from the source.

visible_only: if True, update only visible items

guidata.utils.restore_dataset(source, dest)[source]

Restore dest dataset items from source dataset

This function is almost the same as update_dataset but requires the source to be a DataSet instead of the destination.

Symetrically from update_dataset, dest may also be a dictionary.

guidata.utils.assert_interface_supported(klass, iface)[source]

Makes sure a class supports an interface


Makes sure a class supports the interfaces it declares


Convert local time to ISO date


Convert ISO date to local time

class guidata.utils.FormatTime(hours_fmt='%d H ', min_fmt='%d min ', sec_fmt='%d s')[source]

Helper object that substitute as a string to format seconds into (nn H mm min ss s)

class guidata.utils.Timer[source]

MATLAB-like timer: tic, toc


Starting timer

toc(cat, msg='delta:')[source]

Stopping timer


Return module modname base path


Return program absolute path if installed in PATH Otherwise, return None

guidata.utils.run_program(name, args='', cwd=None, shell=True, wait=False)[source]

Run program in a separate process


Return True if Python module is available

guidata.utils.get_package_data(name, extlist, exclude_dirs=[])[source]

Return data files for package name with extensions in extlist (search recursively in package directories)


Return subpackages of package name


Cythonize all Cython modules in relative path