Utilities

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

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

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

exa.utility.mkp(*args, mk=False)[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.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.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”)