maestral.config

Module contents

maestral.config.MaestralConfig(config_name)[source]

Returns an existing config instance or creates a new one.

Parameters

config_name (str) – Name of maestral configuration to run. A new config file will be created if none exists for the given config_name.

Returns

Maestral config instance which saves any changes to the drive.

Return type

maestral.config.user.UserConfig

maestral.config.MaestralState(config_name)[source]

Returns an existing state instance or creates a new one.

Parameters

config_name (str) – Name of maestral configuration to run. A new state file will be created if none exists for the given config_name.

Returns

Maestral state instance which saves any changes to the drive.

Return type

maestral.config.user.UserConfig

maestral.config.get_conf_path(subfolder=None, filename=None, create=True)[source]

Returns the default config path for the platform. This will be:

  • macOS: “~/Library/Application Support/<subfolder>/<filename>.”

  • Linux: ``XDG_CONFIG_HOME/<subfolder>/<filename>”

  • other: “~/.config/<subfolder>/<filename>”

Parameters
  • subfolder (Optional[str]) – The subfolder for the app.

  • filename (Optional[str]) – The filename to append for the app.

  • create (bool) – If True, the folder subfolder will be created on-demand.

Return type

str

maestral.config.get_data_path(subfolder=None, filename=None, create=True)[source]

Returns the default path to save application data for the platform. This will be:

  • macOS: “~/Library/Application Support/SUBFOLDER/FILENAME”

  • Linux: “$XDG_DATA_DIR/SUBFOLDER/FILENAME”

  • fallback: “$HOME/.local/share/SUBFOLDER/FILENAME”

Note: We do not use “~/Library/Saved Application State” on macOS since this folder is reserved for user interface state and can be cleared by the user / system.

Parameters
  • subfolder (Optional[str]) – The subfolder for the app.

  • filename (Optional[str]) – The filename to append for the app.

  • create (bool) – If True, the folder subfolder will be created on-demand.

Return type

str

maestral.config.list_configs()[source]

Lists all maestral configs.

Returns

A list of all currently existing config files.

Return type

List[str]

maestral.config.remove_configuration(config_name)[source]

Removes all config and state files associated with the given configuration.

Parameters

config_name (str) – The configuration to remove.

Return type

None

maestral.config.validate_config_name(string)[source]

Validates that the config name does not contain any whitespace.

Parameters

string (maestral.config._C) – String to validate.

Returns

The input value.

Raises

ValueError – if the config name contains whitespace.

Return type

maestral.config._C