@contextmanager
def patched_settings(**kwargs):
    old = {}
    for k, v in kwargs.items():
        try:
            old[k] = getattr(settings, k)
        except __HOLE__:
            pass
        setattr(settings, k, v)
    yield
    for k, v in old.items():
        setattr(settings, k, v)
dataset/ETHPy150Open hzdg/django-staticbuilder/staticbuilder/utils.py/patched_settings