def __enter__(self): from foomn import get_settings, set_settings self.tmp_settings = get_settings() settings = get_settings() settings.update(self.override_settings) set_settings(settings) return self
def __exit__(self, *args): from foomn import set_settings set_settings(self.tmp_settings)