@staticmethod
def from_overloadedfuncdef(stub: nodes.OverloadedFuncDef) -> 'Signature[nodes.Argument]':
    "Returns a Signature from an OverloadedFuncDef.\n\n        If life were simple, to verify_overloadedfuncdef, we'd just verify_funcitem for each of its\n        items. Unfortunately, life isn't simple and overloads are pretty deceitful. So instead, we\n        try and combine the overload's items into a single signature that is compatible with any\n        lies it might try to tell.\n\n        "
    assume_positional_only = is_dunder(stub.name, exclude_special=True)
    all_args = {}
    for func in map(_resolve_funcitem_from_decorator, stub.items):
        assert (func is not None)
        args = maybe_strip_cls(stub.name, func.arguments)
        for (index, arg) in enumerate(args):
            name = ('__{}'.format(index) if (arg.variable.name.startswith('__') or assume_positional_only) else arg.variable.name)
            all_args.setdefault(name, []).append((arg, index))

    def get_position(arg_name: str) -> int:
        return max((index for (_, index) in all_args[arg_name]))

    def get_type(arg_name: str) -> mypy.types.ProperType:
        with mypy.state.strict_optional_set(True):
            all_types = [(arg.variable.type or arg.type_annotation) for (arg, _) in all_args[arg_name]]
            return mypy.typeops.make_simplified_union([t for t in all_types if t])

    def get_kind(arg_name: str) -> int:
        kinds = {arg.kind for (arg, _) in all_args[arg_name]}
        if (nodes.ARG_STAR in kinds):
            return nodes.ARG_STAR
        if (nodes.ARG_STAR2 in kinds):
            return nodes.ARG_STAR2
        is_opt = ((len(all_args[arg_name]) < len(stub.items)) or (nodes.ARG_OPT in kinds) or (nodes.ARG_NAMED_OPT in kinds))
        is_pos = ((nodes.ARG_OPT in kinds) or (nodes.ARG_POS in kinds))
        if is_opt:
            return (nodes.ARG_OPT if is_pos else nodes.ARG_NAMED_OPT)
        return (nodes.ARG_POS if is_pos else nodes.ARG_NAMED)
    sig = Signature()
    for arg_name in sorted(all_args, key=get_position):
        example_arg_name = all_args[arg_name][0][0].variable.name
        arg = nodes.Argument(nodes.Var(example_arg_name, get_type(arg_name)), type_annotation=None, initializer=None, kind=get_kind(arg_name))
        if (arg.kind in (nodes.ARG_POS, nodes.ARG_OPT)):
            sig.pos.append(arg)
        elif (arg.kind in (nodes.ARG_NAMED, nodes.ARG_NAMED_OPT)):
            sig.kwonly[arg.variable.name] = arg
        elif (arg.kind == nodes.ARG_STAR):
            sig.varpos = arg
        elif (arg.kind == nodes.ARG_STAR2):
            sig.varkw = arg
        else:
            raise AssertionError
    return sig
Returns a Signature from an OverloadedFuncDef.

If life were simple, to verify_overloadedfuncdef, we'd just verify_funcitem for each of its
items. Unfortunately, life isn't simple and overloads are pretty deceitful. So instead, we
try and combine the overload's items into a single signature that is compatible with any
lies it might try to tell.
@staticmethod
def from_overloadedfuncdef(stub: nodes.OverloadedFuncDef) -> 'Signature[nodes.Argument]':
    "Returns a Signature from an OverloadedFuncDef.\n\n        If life were simple, to verify_overloadedfuncdef, we'd just verify_funcitem for each of its\n        items. Unfortunately, life isn't simple and overloads are pretty deceitful. So instead, we\n        try and combine the overload's items into a single signature that is compatible with any\n        lies it might try to tell.\n\n        "
    assume_positional_only = is_dunder(stub.name, exclude_special=True)
    all_args = {}
    for func in map(_resolve_funcitem_from_decorator, stub.items):
        assert (func is not None)
        args = maybe_strip_cls(stub.name, func.arguments)
        for (index, arg) in enumerate(args):
            name = ('__{}'.format(index) if (arg.variable.name.startswith('__') or assume_positional_only) else arg.variable.name)
            all_args.setdefault(name, []).append((arg, index))

    def get_position(arg_name: str) -> int:
        return max((index for (_, index) in all_args[arg_name]))

    def get_type(arg_name: str) -> mypy.types.ProperType:
        with mypy.state.strict_optional_set(True):
            all_types = [(arg.variable.type or arg.type_annotation) for (arg, _) in all_args[arg_name]]
            return mypy.typeops.make_simplified_union([t for t in all_types if t])

    def get_kind(arg_name: str) -> int:
        kinds = {arg.kind for (arg, _) in all_args[arg_name]}
        if (nodes.ARG_STAR in kinds):
            return nodes.ARG_STAR
        if (nodes.ARG_STAR2 in kinds):
            return nodes.ARG_STAR2
        is_opt = ((len(all_args[arg_name]) < len(stub.items)) or (nodes.ARG_OPT in kinds) or (nodes.ARG_NAMED_OPT in kinds))
        is_pos = ((nodes.ARG_OPT in kinds) or (nodes.ARG_POS in kinds))
        if is_opt:
            return (nodes.ARG_OPT if is_pos else nodes.ARG_NAMED_OPT)
        return (nodes.ARG_POS if is_pos else nodes.ARG_NAMED)
    sig = Signature()
    for arg_name in sorted(all_args, key=get_position):
        example_arg_name = all_args[arg_name][0][0].variable.name
        arg = nodes.Argument(nodes.Var(example_arg_name, get_type(arg_name)), type_annotation=None, initializer=None, kind=get_kind(arg_name))
        if (arg.kind in (nodes.ARG_POS, nodes.ARG_OPT)):
            sig.pos.append(arg)
        elif (arg.kind in (nodes.ARG_NAMED, nodes.ARG_NAMED_OPT)):
            sig.kwonly[arg.variable.name] = arg
        elif (arg.kind == nodes.ARG_STAR):
            sig.varpos = arg
        elif (arg.kind == nodes.ARG_STAR2):
            sig.varkw = arg
        else:
            raise AssertionError
    return sig