def getargspec(obj):
    if not callable(obj):
        raise TypeError("%s is not callable" % type(obj))
    try:
        if inspect.isfunction(obj):
            return inspect.getargspec(obj)
        elif hasattr(obj, FUNC_OBJ_ATTR):
            # For methods or classmethods drop the first
            # argument from the returned list because
            # python supplies that automatically for us.
            # Note that this differs from what
            # inspect.getargspec() returns for methods.
            # NB: We use im_func so we work with
            #     instancemethod objects also.
            spec = inspect.getargspec(getattr(obj, FUNC_OBJ_ATTR))
            return inspect.ArgSpec(spec.args[:1], spec.varargs, spec.keywords, spec.defaults)
        elif inspect.isclass(obj):
            return getargspec(obj.__init__)
        elif isinstance(obj, object):
            # We already know the instance is callable,
            # so it must have a __call__ method defined.
            # Return the arguments it expects.
            return getargspec(obj.__call__)
    except NotImplementedError:
        # If a nested call to our own getargspec()
        # raises NotImplementedError, re-raise the
        # exception with the real object type to make
        # the error message more meaningful (the caller
        # only knows what they passed us; they shouldn't
        # care what aspect(s) of that object we actually
        # examined).
        pass
    raise NotImplementedError("do not know how to get argument list for %s" % type(obj))
Initialize all valid properties.
dataset/ETHPy150Open koenbok/Cactus/cactus/utils/internal.py/getargspec--crossover with--dataset/ETHPy150Open smart-on-fhir/client-py/fhirclient/models/conceptmap.py/ConceptMapElementTargetDependsOn.__init__