Sets up a context in the form a dictionary.
ctx_in – If it is a directory containing keys corresponding to parameter names defined in allowed they will be used. If it is a valid path the file is assumed to be in YAML format and the parameters are read from it.
allowed – A list of the parameter names that are allowed in the context.
types – A list of the data types required for the parameters.
defaults – A list of the default values of the parameters (used if no other values found).
remove_unknowns – If True then parameters that are in ctx_in but not in allowed are not in the returned context.
verbosity – Verbosity level (0 - 4).
verbose – Only for backwards compatibility. Not used.
logger – Only for backwards compatibility. Not used.
A directory containing all the parameter names and their assigned values.
Bases: logging.Formatter
Class to handle customization of logger output format.
Format the specified record as text.
The record’s attribute dictionary is used as the operand to a string formatting operation which yields the returned string. Before formatting the dictionary, a couple of preparatory steps are carried out. The message attribute of the record is computed using LogRecord.getMessage(). If the formatting string uses the time (as determined by a call to usesTime(), formatTime() is called to format the event time. If there is exception information, it is formatted using formatException() and appended to the message.
Initializes a logger instance for a file. :param name: The name of the file for which the logging is done. :param colorized: If True uses coloring of logger messages. :return: Logger instance
Sets the global logging level. Meassages with a logging level below will not be logged.
logger – A logger instance.
logging_level – The logger severity (critical, error, warning, info or debug)
DEPRECATED. Only for backward compatibility Prints a message if verbose is True. Can also redirect output to a logger instance.
message – The message string to print.
logger – Either a logger instance or None
verbose – If True prints the message
level – The severity level of the message (either info, warning, error or debug)
Creates a standardised path for files. The meta data is encoded in the path and can be savely recovered using the get_parameters_from_path function. NOTE: Your variable names must not contain underscores or equal signs!
identity – The prefix of the name.
out_folder – The directory of the file.
defined_parameters – A dictionary of key value pairs.
undefined_parameters – A list of parameters that do not have a name (be mindful about their order when reading them from the name again!).
suffix – What should go at the end of the name.
verbosity – Verbosity level (0 - 4).
A string which is the created path.
Given a list of standardised paths, or a single path created with create_path() this function reads the parameters in the paths.
paths – Either a single string or a list of strings. The strings should be paths in the create_path() format.
suffix – If True assumes that the given paths have suffixes
fmt – Format string in format: %s_%i_%b etc. The order is the same as the attributes that should be read from the path. Accepts: %s = string, %i = integer, %f = float, %b = boolean
verbosity – Verbosity level (0 - 4).
Returns a dictionary which contains the defined parameters and a list containing the undefined parameters.
Creates a directory if it does not exist. Just a wrapper around pathlib but kept for backwards compatibility.
path – The path to the directory that should be created.
exist_ok – If set to True ignores errors raised if
directory already exists. :param parents: If True creates full directory tree. :param verbosity: Verbosity level (0 - 4).