running package

Submodules

running.config module

Helper functions to deal with configuration files

running.config.load_config_ini(full_path)
running.config.merge_defaults(config)

Merge a dictionary that has an item with a “DEFAULT” key, if that item is itself a dictionary, then merge that item’s subitems with all the other items in the dictionary that are also themselves dictionaries.

The purpose is to mimic the behaviour of the [DEFAULT] sections of .ini or .conf files when using .json or .yaml files, or when using OrderedDict or dict data structures.

Parameters:config (dict or OrderedDict) – The dictionary that is to have its “DEFAULT” key merged with the other keys.
Returns:The merged version of the dictionary as an OrderedDict, or the original config (be it a dict or an OrderedDict) if it had no “DEFAULT” key to begin with, or it was not a dict or an OrderedDict.
Return type:OrderedDict or dict

running.dates module

Helper functions to deal with dates

running.dates.current_date(utc_setting=True, moment=None)

The current date as text in the ISO format.

Parameters:
  • utc_setting (bool, optional) – Whether we want the current moment to be timezone agnostic. (the default is True, which denotes to be timezone agnostic.)
  • moment (datetime.datetime, optional) – The moment considered to be the “now” moment. (the default is None, which denotes the use of the current moment.) This parameter is mostly useful for testing purposes, otherwise it shouldn’t be provided.
Returns:

The current date as text.

Return type:

str

running.dates.current_day(utc_setting=True, moment=None)

The current day of the week.

Parameters:
  • utc_setting (bool, optional) – Whether we want the current moment to be timezone agnostic. (the default is True, which denotes to be timezone agnostic.)
  • moment (datetime.datetime, optional) – The moment considered to be the “now” moment. (the default is None, which denotes the use of the current moment.) This parameter is mostly useful for testing purposes, otherwise it shouldn’t be provided.
Returns:

The current day of the week in range [0, 6], Monday is 0.

Return type:

int

running.dates.current_seconds(moment=None)

The seconds of the current minute.

Parameters:moment (datetime.datetime, optional) – The moment considered to be the “now” moment. (the default is None, which denotes the use of the current moment.) This parameter is mostly useful for testing purposes, otherwise it shouldn’t be provided.
Returns:The current seconds within the current minute.
Return type:int
running.dates.current_seconds_milliseconds(moment=None)

The seconds and milliseconds of the current minute.

Parameters:moment (datetime.datetime, optional) – The moment considered to be the “now” moment. (the default is None, which denotes the use of the current moment.) This parameter is mostly useful for testing purposes, otherwise it shouldn’t be provided.
Returns:The current seconds, with the milliseconds after the decimal point.
Return type:float
running.dates.current_time(utc_setting=True, moment=None)

The current time of the day in the HH:MM format (no seconds).

Parameters:
  • utc_setting (bool, optional) – Whether we want the current moment to be timezone agnostic. (the default is True, which denotes to be timezone agnostic.)
  • moment (datetime.datetime, optional) – The moment considered to be the “now” moment. (the default is None, which denotes the use of the current moment.) This parameter is mostly useful for testing purposes, otherwise it shouldn’t be provided.
Returns:

The current time of the day as text.

Return type:

str

running.dates.now(utc_setting=True, timezone=None, timestamp=None)

The current moment in time.

Parameters:
  • utc_setting (bool, optional) – Whether we want the current moment to be timezone agnostic. (the default is True, which denotes to be timezone agnostic.)
  • timezone (datetime.timezone, optional) – Which timezone we want the current moment to be reported in. (the default is None, which denotes the local machine’s timezone.)
  • timestamp (float, optional) – POSIX timestamp of the moment considered to be the “now” moment. (the default is None, which denotes the use of the current moment.) This parameter is mostly useful for testing purposes, otherwise it shouldn’t be provided.
Returns:

the_now_moment – The current moment.

Return type:

datetime.datetime

Module contents

“running” package