def get_target_sig(self, act_as_func_def, target_func_def, is_dynamic, is_wrapper_class): """Return the target method signature for a method wrapper.""" sig = function_type(target_func_def) if is_wrapper_class: if sig.is_generic() and is_dynamic: sig = translate_function_type_vars_to_dynamic(sig) return translate_type_vars_to_wrapped_object_vars(sig) elif is_dynamic: if sig.is_generic(): return translate_function_type_vars_to_dynamic(sig) else: return sig else: return sig
def get_target_sig(self, act_as_func_def: FuncDef, target_func_def: FuncDef, is_dynamic: bool, is_wrapper_class: bool) -> Callable: """Return the target method signature for a method wrapper.""" sig = cast(Callable, function_type(target_func_def)) if is_wrapper_class: if sig.is_generic() and is_dynamic: sig = cast(Callable, translate_function_type_vars_to_dynamic(sig)) return cast(Callable, translate_type_vars_to_wrapped_object_vars(sig)) elif is_dynamic: if sig.is_generic(): return cast(Callable, translate_function_type_vars_to_dynamic(sig)) else: return sig else: return sig
self.tf.add_line_mapping(target_func_def, wrapper_func_def) if is_wrapper_class and not is_dynamic: self.tf.prepend_generic_function_tvar_args(wrapper_func_def) return wrapper_func_def Callable get_target_sig(self, FuncDef act_as_func_def, FuncDef target_func_def, bool is_dynamic, bool is_wrapper_class): """Return the target method signature for a method wrapper.""" sig = (Callable)function_type(target_func_def) if is_wrapper_class: if sig.is_generic() and is_dynamic: sig = (Callable)translate_function_type_vars_to_dynamic(sig) return (Callable)translate_type_vars_to_wrapped_object_vars(sig) elif is_dynamic: if sig.is_generic(): return (Callable)translate_function_type_vars_to_dynamic(sig) else: return sig else: return sig Callable get_wrapper_sig(self, FuncDef act_as_func_def, bool is_dynamic): """Return the signature of the wrapper method. The wrapper method signature has an additional type variable argument (with type 'any'), and all type variables have been erased. """