# -*- encoding: utf-8 -*-

from typing import Callable
from typing import List


class KeywordArgumentsDeleter(object):
    def __init__(self, *kwargs_changes: List[str]):
        for oldkw in kwargs_changes:
            assert isinstance(oldkw, str)
        self.kwargs_changes = kwargs_changes

    def __call__(self, c):
        return KeywordArgumentsDeleterConfigured(c, *self.kwargs_changes)


class KeywordArgumentsDeleterConfigured(object):  # Don't instantiate this class manually
    def __init__(self, clb: Callable, *kwargs_changes: List[str]):
        self.kwargs_changes = kwargs_changes
        self.callback = clb
    
    def __call__(self, *args, **kwargs):
        newkwargs = kwargs.copy()
        for k in self.kwargs_changes:
            if k in newkwargs:
                del newkwargs[k]
        return self.callback(*args, **newkwargs)