smarts.core.utils.core_logging module

smarts.core.utils.core_logging.diff_unpackable(obj, other_obj)[source]

Do an asserted comparison of an object that is able to be unpacked. This works with nested collections: dictionaries, named-tuples, tuples, lists, numpy arrays, and dataclasses.

Raises:

AssertionError – if objects do not match.

smarts.core.utils.core_logging.isnotebook()[source]

Determines if executing in ipython (Jupyter Notebook)

smarts.core.utils.core_logging.suppress_output(stderr=True, stdout=True)[source]

Attempts to suppress console print statements.

Parameters:
  • stderr – Suppress stderr.

  • stdout – Suppress stdout.

smarts.core.utils.core_logging.suppress_websocket()[source]

Attempts to filter out irritating websocket library messages.

smarts.core.utils.core_logging.timeit(name: str, log)[source]

Context manger that stopwatches the amount of time between context block start and end.

import logging
with timeit(n,logging.log):
     a = a * b
smarts.core.utils.core_logging.try_fsync(fd)[source]

Attempts to see if fsync will work. Workaround for error on GitHub Actions.