mstrio.utils.settings package¶
Submodules¶
mstrio.utils.settings.base_settings module¶
- class mstrio.utils.settings.base_settings.BaseSettings¶
Bases:
object
Base class for fetching and updating Project or Server Settings. The settings object can be optionally initialized with connection and id, which will automatically fetch the current settings for the specified object. If not specified, settings can be loaded from file using import_from() method. Settings attributes can be modified manually. Lastly, the settings object can be validated and applied to a given object (Project, Server) using the update() method.
- settings¶
settings
- alter(**settings)¶
Alter settings in a command manager like way.
- compare_with_files(files: List[str], show_diff_only: bool = False) DataFrame ¶
Compare the current project settings to settings in file/files :param files: List of paths to the settings files. Supported settings
files are JSON, CSV, Pickle. Ex: “/file.csv”
- Parameters:
show_diff_only (bool, optional) – Whether to display all settings or only different from first project in list.
- Returns:
Dataframe with values of current settings and settings from files.
- fetch() None ¶
Fetch current settings from I-Server and update this Settings object.
- import_from(file: str) None ¶
Import project settings from a ‘csv’, ‘json’ or ‘pickle’ file.
- Parameters:
file (str) – Path to the file with supported extension type name. Ex: “<path>/file.csv”
- list_properties(show_names: bool = True) dict ¶
Return settings and their values as dictionary.
- Parameters:
show_names – if True, return meaningful setting values, else, return exact setting values
- to_csv(name: str) None ¶
Export the current project settings to the csv file.
- Parameters:
name (str) – Name of file
- to_dataframe() DataFrame ¶
Return a DataFrame object containing settings and their values.
- to_json(name: str) None ¶
Export the current project settings to the json file :param name: Name of file :type name: str
- to_pickle(name: str) None ¶
Export the current project settings to the pickle file :param name: Name of file :type name: str
- abstract update() None ¶
Update the current settings on I-Server using this Settings object.
mstrio.utils.settings.setting_types module¶
- class mstrio.utils.settings.setting_types.BoolSetting(config: dict)¶
Bases:
SettingValue
Representation of a Boolean setting type.
- class mstrio.utils.settings.setting_types.DeprecatedSetting(config: dict)¶
Bases:
object
Representation of a Deprecated setting type.
- class mstrio.utils.settings.setting_types.EmailSetting(config: dict)¶
Bases:
SettingValue
Representation of a Email setting type.
- class mstrio.utils.settings.setting_types.EnumSetting(config: dict)¶
Bases:
SettingValue
Representation of an Enum setting type.
- class mstrio.utils.settings.setting_types.MstrObjectSetting(config: dict)¶
Bases:
SettingValue
Representation of an MstrObject setting type.
- class mstrio.utils.settings.setting_types.NumberSetting(config: dict)¶
Bases:
SettingValue
Representation of a Number setting type.
- class mstrio.utils.settings.setting_types.ObjectSetting(config: dict)¶
Bases:
SettingValue
Representation of an Object setting type.
- class mstrio.utils.settings.setting_types.SettingValue(config: dict)¶
Bases:
object
Base Settings Value class.
It represents single setting configuration.
- class mstrio.utils.settings.setting_types.SettingValueFactory¶
Bases:
object
- get_setting(config: dict) SettingValue ¶
- class mstrio.utils.settings.setting_types.StringSetting(config: dict)¶
Bases:
SettingValue
Representation of a String setting type.
- class mstrio.utils.settings.setting_types.TimeSetting(config: dict)¶
Bases:
SettingValue
Representation of a Time setting type.
mstrio.utils.settings.settings_helper module¶
- mstrio.utils.settings.settings_helper.convert_settings_to_byte(settings: dict, mapping: dict) dict ¶
- mstrio.utils.settings.settings_helper.convert_settings_to_mega_byte(settings: dict, mapping: dict) dict ¶
mstrio.utils.settings.settings_io module¶
- class mstrio.utils.settings.settings_io.CSVSettingsIO¶
Bases:
SettingsIO
- FILE_NAME: Optional[Union[str, tuple]] = '.csv'¶
- PROJECT_VERSION: Optional[int] = 1¶
- SERVER_VERSION: Optional[int] = 2¶
- classmethod check_type(settings_type: Optional[str], settings_obj: BaseSettings) None ¶
- classmethod check_version(version: Optional[int], settings_type: str) None ¶
- classmethod from_file(file: str, settings_obj: BaseSettings) dict ¶
- classmethod process_csv_settings(settings: dict, settings_obj: BaseSettings) dict ¶
Helper function to extract settings from csv settings files.
- classmethod to_file(file: str, settings_obj: BaseSettings) None ¶
- class mstrio.utils.settings.settings_io.JSONSettingsIO¶
Bases:
SettingsIO
- FILE_NAME: Optional[Union[str, tuple]] = '.json'¶
- PROJECT_VERSION: Optional[int] = 2¶
- SERVER_VERSION: Optional[int] = 2¶
- classmethod from_file(file: str, settings_obj: BaseSettings) dict ¶
- classmethod to_file(file: str, settings_obj: BaseSettings) None ¶
- class mstrio.utils.settings.settings_io.PickleSettingsIO¶
Bases:
SettingsIO
- FILE_NAME: Optional[Union[str, tuple]] = ('.pkl', '.pickle', '.p')¶
- PROJECT_VERSION: Optional[int] = 2¶
- SERVER_VERSION: Optional[int] = 2¶
- classmethod from_file(file: str, settings_obj: BaseSettings) dict ¶
- classmethod to_file(file: str, settings_obj: BaseSettings) None ¶
- class mstrio.utils.settings.settings_io.SettingsIO¶
Bases:
object
- FILE_NAME: Optional[Union[str, tuple]] = None¶
- PROJECT_VERSION: Optional[int] = None¶
- SERVER_VERSION: Optional[int] = None¶
- classmethod check_type(settings_type: Optional[str], settings_obj: BaseSettings) None ¶
- classmethod check_version(version: Optional[Union[str, int]], settings_type: Optional[str]) None ¶
- abstract classmethod from_file(file: str, settings_obj: BaseSettings) dict ¶
- classmethod get_version(settings_obj: BaseSettings) int ¶
- abstract classmethod to_file(file: str, settings_obj: BaseSettings) None ¶
- classmethod validate_file_name(file)¶