def _cache_project(config, owner=None, project=None): if ProjectManager.is_initialized() and ProjectManager.is_locally_initialized(): if _is_same_project(owner, project): ProjectManager.set_config(config) return ProjectManager.set_config(config, visibility=ProjectManager.VISIBILITY_GLOBAL)
def cache(config_manager, config, owner=None, project=None): if config_manager == ProjectManager: _cache_project(config=config, project=project, owner=owner) # Set caching only if we have an initialized project if not ProjectManager.is_initialized(): return if not _is_same_project(owner, project): return visibility = ( ProjectManager.VISIBILITY_LOCAL if ProjectManager.is_locally_initialized() else ProjectManager.VISIBILITY_GLOBAL ) config_manager.set_config(config, visibility=visibility)