in modular_cli_sdk/services/credentials_manager.py [0:0]
def store(self, config: dict) -> str:
try:
Path(self.creds_folder_path).mkdir(exist_ok=True, parents=True)
except OSError as e:
_LOG.error(
f'Unable to create configuration folder '
f'{self.creds_folder_path}. Reason: {str(e)}')
raise ModularCliSdkConfigurationException(
f'Unable to create configuration folder {self.creds_folder_path}'
)
with open(self.config_file_path, 'w+') as config_file:
json.dump(config, config_file)
_LOG.debug(
f'Configuration created successfully. Stored by path: '
f'{self.config_file_path}')
# todo review:fix
# TODO, I think it's bad to return these obviously human strings here.
# We should return bool or None or smt, and the user of this class
# must decide what string to output based on the result.
# But no - we simply imply our string which may or may not be
# appropriate.
# Also, it's not easily readable for PC: clean_up returns different
# strings in case the config was or wasn't cleaned. And how is the
# programmers supposed to know, whether the config was cleaned?
# By using regex?
return f'The configuration for {self.module_name} tool was ' \
f'successfully saved locally'