def get_import_func_calls()

in uberpoet/filegen.py [0:0]


def get_import_func_calls(from_language, import_list, indent=0):
    out = []
    for i in import_list:
        if type(i) is str:
            continue
        module = first_in_dict(i)
        to_language = module["language"]
        for file_result in module["files"].values():
            for class_num, class_funcs in file_result.classes.items():
                for func_type, func_nums in class_funcs.items():
                    for func_num in func_nums:
                        if (func_type == FuncType.SWIFT_ONLY and from_language == Language.OBJC and
                                to_language == Language.SWIFT):
                            # We cannot invoke Swift only functions from ObjC since they use generics.
                            continue
                        text = get_func_call_template(from_language, to_language, func_type).format(class_num, func_num)
                        indented_text = '\n'.join(" " * indent + line for line in text.splitlines())
                        out.append(indented_text)

    return "\n".join(out)