prefs

Module to hold module-global variables as preferences.

Warning

DO NOT hardcode prefs here.

A prefs.json file should be generated with an appropriate autopilot.setup routine

Before importing any other autopilot module,

Examples

from autopilot import prefs prefs_file = ‘/usr/autopilot/prefs.json’ # or some .json prefs file prefs.init(prefs_file)

And to add a pref

Examples

prefs.add(‘PARAM’, ‘VALUE”)

autopilot.prefs.prefdict = {'AGENT': 'docs', 'AUDIOSERVER': 'docs'}

stores a dictionary of preferences that mirrors the global variables.

autopilot.prefs.init(fn)[source]

Initialize prefs on autopilot start.

Parameters:fn (str, dict) – a path to prefs.json or a dictionary of preferences
autopilot.prefs.add(param, value)[source]

Add a pref after init

Parameters:
  • param (str) – Allcaps parameter name
  • value – Value of the pref
autopilot.prefs.git_version(repo_dir)[source]

Get the git hash of the current commit.

Stolen from numpy’s setup

and linked by ryanjdillon on SO

Parameters:repo_dir (str) – directory of the git repository.
Returns:git commit hash.
Return type:unicode
autopilot.prefs.compute_calibration(path=None, calibration=None, do_return=False)[source]