mentat.script.fetcher

This module provides base implementation of generic message fetching and processing script. This script will take care of initializing mentat.plugin.app.storage.StoragePlugin and provides methods for fetching messages from database.

class mentat.script.fetcher.DemoFetcherScript(name=None, description=None)[source]

Bases: mentat.script.fetcher.FetcherScript

This is an internal implementation of FetcherScript usable only for demonstration purposes.

cbk_command_demo()[source]

Implementation of the ‘demo’ command (default command).

get_default_command()[source]

Return the name of a default script command.

Returns:Name of the default command.
Return type:str
class mentat.script.fetcher.FetcherScript(**kwargs)[source]

Bases: pyzenkit.zenscript.ZenScript

Base implementation of generic message fetching and processing script.

fetch_all_messages()[source]

Fetch all messages from database collection.

Returns:List of messages fetched from database.
Return type:list
fetch_messages(time_low, time_high)[source]

Fetch messages from database collection withing time interval defined by given upper and lower time boundary.

Parameters:
  • time_low (datetime.datetime) – Lower time interval boundary.
  • time_high (datetime.datetime) – Upper time interval boundary.
Returns:

List of messages fetched from database.

Return type:

list

static initialize_result(time_low, time_high, interval, result=None)[source]

Initialize the result data structure.

Parameters:
  • time_low (datetime.datetime) – Lower time interval boundary.
  • time_high (datetime.datetime) – Upper time interval boundary.
  • interval (str) – Time interval, one of the interval defined in pyzenkit.zenscript.
  • result (dict) – Result data structure.
Returns:

Result data structure.

Return type:

dict