from typing import Set
import inspect


def get_init_properties(cls, to_class=object) -> Set[str]:
    """Given a class, determine the properties that class needs.
    Assumes that each sub-class will call super with **kwargs. (Which is not a
    good general assumption, but should work well enough for Handlers.)

    cls is the class to check, to_class is the final parent class to check.

    Returns a set of all parameters found.
    """
    result = set()
    init = getattr(cls, '__init__', None)

    if init is not None:
        for param in inspect.signature(init).parameters.values():
            if param.kind == param.VAR_KEYWORD:
                # Ignore any **kwargs
                continue
            if param.name == 'self':
                continue

            result.add(param.name)

    if issubclass(cls.mro()[1], to_class):
        result |= get_init_properties(cls.mro()[1], to_class)

    return result