parameters: ()
return_statement: return installed_addons
docstring: Get the git hash to save with data to ensure reproducibility.
docstring_summary: Get the git hash to save with data to ensure reproducibility.
docstring_tokens: Get the git hash to save with data to ensure reproducibility .
function: def get_addons():
      """Get the git hash to save with data to ensure reproducibility."""
      try:
          output = subprocess.check_output(["ha", "addons", "--raw-json"])
      except FileNotFoundError:
          # the 'ha' program isn't available in the host image, I can only
          # run it from the 'SSH & Web Terminal' Add-on.
          return None
      raw = output.decode("utf-8")
      addons = json.loads(raw)["data"]
      installed_addons = [addon for addon in addons["addons"] if addon["installed"]]
      return installed_addons
function_tokens: def get_addons ( ) : try : output = subprocess . check_output ( [ "ha" , "addons" , "--raw-json" ] ) except FileNotFoundError : # the 'ha' program isn't available in the host image, I can only # run it from the 'SSH & Web Terminal' Add-on. return None raw = output . decode ( "utf-8" ) addons = json . loads ( raw ) [ "data" ] installed_addons = [ addon for addon in addons [ "addons" ] if addon [ "installed" ] ] return installed_addons