searchmate package

Subpackages

Submodules

searchmate.config module

This module manages configuration for Searchmate.

class searchmate.config.Config(config_file=None)

Bases: object

This class is a parent class for app and skills classes.

config_file

Path to a config file.

get(section, option)

Reads the setting value from an option name.

Parameters:
  • section (str) – Section’s name.

  • option (str) – Option’s name.

Returns:

Option’s saved value.

Return type:

str

load_config()

Loads the config file to an object.

Return type:

None

save_config()

Saves object content to a config file.

Return type:

None

set(section, option, value)

Sets option’s value.

Parameters:
  • section (str) – Section to choose option from.

  • option (str) – Option to change.

  • value (str) – Value to change to an option.

Return type:

None

searchmate.skill module

Abstract skill class.

class searchmate.skill.Skill

Bases: ABC

Abstract skill class, needs to be a parent of each skill.

abstract run(query)

Code to be executed when running skill.

Parameters:

query (str) – Users’ text input.

Returns:

Text to display after skill runs.

Return type:

Optional[Dict[str, str]]

abstract suggestion(query)

What to display before executing skill.

Parameters:

query (str) – Users’ text input.

Returns:

Text to display before skill runs.

Return type:

Optional[Dict[str, str]]

searchmate.skill_loader module

SkillLoader is a basic component where all skills get loaded. It checks ‘skills/’ directory in package home and loads all skills. It also recognizes which skill should run with given input.

exception searchmate.skill_loader.InvalidSkillException(message)

Bases: Exception

Exception to throw when a skill is invalid.

class searchmate.skill_loader.SkillLoader

Bases: object

SkillLoader is a basic component where all skills get loaded. It checks ‘skills/’ directory in package home and loads all skills. It also recognizes which skill should run with given input.

get_suggestion(query)

Searches for a skill and takes its suggesstion to a program.

Parameters:

query (str) – Users’ text input.

Returns:

Skill’s suggestion or None.

Return type:

Optional[Dict[str, str]]

run(query)

Searches for a skill and runs it.

Parameters:

query (str) – Users’ text input.

Returns:

Skill’s text output or None.

Return type:

Optional[Dict[str, str]]

Module contents