from typing import Any
from typing import Set
import inspect
from unittest.mock import Mock


def _get_default_arguments(obj: Any) -> Set[str]:
    """Get the names of the default arguments on an object

    The default arguments are determined by comparing the object to one constructed
    from the object's class's initializer with Mocks for all positional arguments

    Arguments:
        obj: the object to find default arguments on

    Returns:
        the set of default arguments

    """
    cls = type(obj)
    obj_sig = inspect.signature(cls.__init__)
    try:
        mocked_obj = cls(
            **{
                param.name: Mock()
                for param in obj_sig.parameters.values()
                if param.default == param.empty
                and param.kind != param.VAR_KEYWORD
                and param.name != "self"
            }
        )
    except Exception:
        return set()
    return {
        key
        for key, value in obj.__dict__.items()
        if key in mocked_obj.__dict__ and mocked_obj.__dict__[key] == value
    }