Public Member Functions | |
def | __getitem__ (self, key) |
def | __hash__ (self) |
def | __init__ (self, directory, name) |
def | __setitem__ (self, key, value) |
def | hash (self, string) |
def | initialize_remote_settings (self) |
def | load_skill_settings_from_file (self) |
def | run_poll (self, _=None) |
def | save_skill_settings (self, skill_settings) |
def | set_changed_callback (self, callback) |
def | skill_gid (self) |
def | stop_polling (self) |
def | store (self, force=False) |
def | update_remote (self) |
Public Attributes | |
allow_overwrite | |
api | |
changed_callback | |
config | |
display_name | |
is_alive | |
loaded_hash | |
name | |
Private Member Functions | |
def | _init_blank_meta (self) |
def | _is_stored (self) |
def | _load_settings_meta (self) |
def | _migrate_settings (self, settings_meta) |
def | _poll_skill_settings (self) |
def | _request_my_settings (self, identifier) |
def | _request_settings (self) |
def | _send_settings_meta (self, settings_meta) |
def | _should_upload_from_change (self) |
def | _type_cast (self, settings_meta, to_platform) |
def | _upload_meta (self, settings_meta, identifier) |
Dictionary that can easily be saved to a file, serialized as json. It also syncs to the backend for skill settings Args: directory (str): Path to storage directory name (str): user readable name associated with the settings no_upload (bool): True if the upload to mycroft servers should be disabled.
Definition at line 118 of file settings.py.
def mycroft.skills.settings.SkillSettings.__init__ | ( | self, | |
directory, | |||
name | |||
) |
Definition at line 129 of file settings.py.
def mycroft.skills.settings.SkillSettings.__getitem__ | ( | self, | |
key | |||
) |
Get key
Definition at line 243 of file settings.py.
def mycroft.skills.settings.SkillSettings.__hash__ | ( | self | ) |
Simple object unique hash.
Definition at line 181 of file settings.py.
def mycroft.skills.settings.SkillSettings.__setitem__ | ( | self, | |
key, | |||
value | |||
) |
Add/Update key.
Definition at line 247 of file settings.py.
|
private |
Send blank settingsmeta to remote.
Definition at line 379 of file settings.py.
|
private |
Definition at line 240 of file settings.py.
|
private |
Load settings metadata from the skill folder. If no settingsmeta exists a basic settingsmeta will be created containing a basic identifier. Returns: (dict) settings meta
Definition at line 252 of file settings.py.
|
private |
sync settings.json and settingsmeta in memory
Definition at line 331 of file settings.py.
|
private |
If identifier exists for this skill poll to backend to request settings and store it if it changes TODO: implement as websocket
Definition at line 397 of file settings.py.
|
private |
Get skill settings for this device associated with the identifier Args: identifier (str): a hashed_meta Returns: skill_settings (dict or None): returns a dict if matches
Definition at line 502 of file settings.py.
|
private |
Get all skill settings for this device from server. Returns: dict: dictionary with settings collected from the server.
Definition at line 522 of file settings.py.
|
private |
Send settingsmeta to the server. Args: settings_meta (dict): dictionary of the current settings meta Returns: dict: uuid, a unique id for the setting meta data
Definition at line 289 of file settings.py.
|
private |
Definition at line 537 of file settings.py.
|
private |
Tranform data type to be compatible with Home and/or Core. e.g. Web to core "true" => True, "1.4" => 1.4 core to Web False => "false' Args: settings_meta (dict): skills object to_platform (str): platform to convert compatible data types to Returns: dict: skills object
Definition at line 446 of file settings.py.
|
private |
uploads the new meta data to settings with settings migration Args: settings_meta (dict): settingsmeta.json or settingsmeta.yaml identifier (str): identifier for skills meta data
Definition at line 347 of file settings.py.
def mycroft.skills.settings.SkillSettings.hash | ( | self, | |
string | |||
) |
md5 hasher for consistency across cpu architectures
Definition at line 359 of file settings.py.
def mycroft.skills.settings.SkillSettings.initialize_remote_settings | ( | self | ) |
initializes the remote settings to the server
Definition at line 207 of file settings.py.
def mycroft.skills.settings.SkillSettings.load_skill_settings_from_file | ( | self | ) |
If settings.json exist, open and read stored values into self
Definition at line 433 of file settings.py.
def mycroft.skills.settings.SkillSettings.run_poll | ( | self, | |
_ = None |
|||
) |
Immediately poll the web for new skill settings
Definition at line 185 of file settings.py.
def mycroft.skills.settings.SkillSettings.save_skill_settings | ( | self, | |
skill_settings | |||
) |
Takes skill object and save onto self Args: skill_settings (dict): skill
Definition at line 314 of file settings.py.
def mycroft.skills.settings.SkillSettings.set_changed_callback | ( | self, | |
callback | |||
) |
Set callback to perform when server settings have changed. Args: callback: function/method to call when settings have changed
Definition at line 198 of file settings.py.
def mycroft.skills.settings.SkillSettings.skill_gid | ( | self | ) |
Finalizes the skill gid to include device uuid if needed.
Definition at line 173 of file settings.py.
def mycroft.skills.settings.SkillSettings.stop_polling | ( | self | ) |
Definition at line 191 of file settings.py.
def mycroft.skills.settings.SkillSettings.store | ( | self, | |
force = False |
|||
) |
Store dictionary to file if a change has occured. Args: force: Force write despite no change
Definition at line 557 of file settings.py.
def mycroft.skills.settings.SkillSettings.update_remote | ( | self | ) |
update settings state from server
Definition at line 363 of file settings.py.
|
private |
Definition at line 160 of file settings.py.
|
private |
Definition at line 149 of file settings.py.
|
private |
Definition at line 153 of file settings.py.
|
private |
Definition at line 147 of file settings.py.
|
private |
Definition at line 148 of file settings.py.
|
private |
Definition at line 143 of file settings.py.
|
private |
Definition at line 154 of file settings.py.
|
private |
Definition at line 142 of file settings.py.
|
private |
Definition at line 155 of file settings.py.
|
private |
Definition at line 152 of file settings.py.
|
private |
Definition at line 518 of file settings.py.
|
private |
Definition at line 141 of file settings.py.
|
private |
Definition at line 150 of file settings.py.
mycroft.skills.settings.SkillSettings.allow_overwrite |
Definition at line 135 of file settings.py.
mycroft.skills.settings.SkillSettings.api |
Definition at line 137 of file settings.py.
mycroft.skills.settings.SkillSettings.changed_callback |
Definition at line 151 of file settings.py.
mycroft.skills.settings.SkillSettings.config |
Definition at line 138 of file settings.py.
mycroft.skills.settings.SkillSettings.display_name |
Definition at line 161 of file settings.py.
mycroft.skills.settings.SkillSettings.is_alive |
Definition at line 145 of file settings.py.
mycroft.skills.settings.SkillSettings.loaded_hash |
Definition at line 146 of file settings.py.
mycroft.skills.settings.SkillSettings.name |
Definition at line 139 of file settings.py.