def clean_up_configuration()

in modular_cli/service/config.py [0:0]


def clean_up_configuration():
    folder_path = get_credentials_folder()
    config_file_path = folder_path / CREDENTIALS_FILE_NAME
    m3_modular_cli_dir, _ = os.path.split(os.path.dirname(__file__))
    commands_meta_path = os.path.join(m3_modular_cli_dir, COMMANDS_META)
    is_config_file_path = config_file_path.exists()
    is_commands_meta_path = os.path.exists(commands_meta_path)
    SYSTEM_LOG.debug(f'Config file exists: {is_config_file_path}')
    SYSTEM_LOG.debug(f'Commands meta file exists: {is_commands_meta_path}')
    try:
        if is_config_file_path:
            os.remove(path=str(config_file_path))
        if is_commands_meta_path:
            os.remove(commands_meta_path)
    except OSError:
        SYSTEM_LOG.exception(
            f'Error occurred while cleaning '
            f'configuration by path: {folder_path}')
    return 'The Modular-CLI tool configuration has been deleted.'