libgs.utils

date:Thu Jul 27 20:40:36 2017
author:Kjetil Wormnes

This module contains utilities and settings for the libgs package.

Functions and classes from utils can be imported to provide useful and common functionality across the application.

Note

Implementers should take particular note of wait_loop() which will allow you to wait for events, or perform an equivalent of time.sleep while aborting in case of termination events. The blocking time.sleep should be avoided as much as possible.

Functions

bytes2hex(data) Helper function to convert a bytearray to a hex string AA-BB-CC-…
bytes2prettyhex(data[, whitespacelen]) Helper function to convert a bytearray to a pretty printed hex string.
conv_time(d[, to, float_t, ignore_ambig_types]) Convert between different time/date types used in libgs
hex2bytes(hexstr) Helper function to convert a hex string (AA-BB-CC-…) to a python bytearray
raise_if_aborted() Raises an exception if the abort_all global event has been set.
safe_sleep(t) Sleep for a specified number of seconds.
schedule_regular_callback(func, delay) A wrapper for RegularCallback
setup_logger(logger[, cons_loglvl, …]) Function to set up logging for libgs.
wait_loop([events_or_callables, timeout, dt]) Generic waiting loop.

Classes

Defaults Defines default values used by the different classes.
RegularCallback(func, delay[, min_interval]) Invokes a callback at regular intervals.
UTCLogFormatter([fmt, datefmt]) A logging formatter that displays records in UTC (zulu) time
UTCLogFormatterHTML([fmt, datefmt]) A logging formatter that displays records in UTC (zulu) time and uses HTML tags for formatting.
XMLRPCTimeoutServerProxy(uri[, timeout, …]) Deprecated in favor of libgs_ops.rpc.RPCClient.

Exceptions

AbortAllException(msg[, original_Error]) Exception representing the abort_all event
Error(msg[, original_Error]) Generic Error for libgs