exa.util.utility module

Utilities

Commonly used functions (primarily for convenience and repetition reduction).

exa.util.utility.datetime_header(title='')[source]

Creates a simple header string containing the current date/time stamp delimited using “=”.

exa.util.utility.mkp(*args, mk=True)[source]

Generate a directory path, and create it if requested.

filepath = mkp('base', 'folder', 'file')
dirpath = mkp('root', 'path', 'folder', mk=True)
Parameters
  • args – File or directory path segments to be concatenated

  • mk (bool) – Make the directory (if it doesn’t exist)

Returns

path (str) – File or directory path

exa.util.utility.convert_bytes(value)[source]

Reduces bytes to more convenient units (i.e. KiB, GiB, TiB, etc.).

Parameters

values (int) – Value in Bytes

Returns

tup (tuple) – Tuple of value, unit (e.g. (10, ‘MiB’))

exa.util.utility.get_internal_modules(key='exa')[source]

Get a list of modules belonging to the given package.

Parameters

key (str) – Package or library name (e.g. “exa”)