Example #1
0
    def get_wrapper_sig(self, act_as_func_def, 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.
        """
        sig = function_type(act_as_func_def)
        if is_dynamic:
            return dynamic_sig(sig)
        elif is_generic(act_as_func_def):
            return erase_generic_types(sig) # FIX REFACTOR?
        else:
            return sig
Example #2
0
    def get_wrapper_sig(self, act_as_func_def: FuncDef,
                        is_dynamic: bool) -> Callable:
        """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.
        """
        sig = cast(Callable, function_type(act_as_func_def))
        if is_dynamic:
            return dynamic_sig(sig)
        elif is_generic(act_as_func_def):
            return cast(Callable, erase_generic_types(sig)) # FIX REFACTOR?
        else:
            return sig
Example #3
0
                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.
        """
        sig = (Callable)function_type(act_as_func_def)
        if is_dynamic:
            return dynamic_sig(sig)
        elif is_generic(act_as_func_def):
            return (Callable)erase_generic_types(sig) # FIX REFACTOR?
        else:
            return sig
    
    Callable get_call_sig(self, FuncDef act_as_func_def,
                          TypeInfo current_class, bool is_dynamic,
                          bool is_wrapper_class, bool is_override):
        """Return the source signature in a wrapped call.
        
        It has type variables replaced with 'any', but as an
        exception, type variables are intact in the return type in
        generic wrapper classes. The exception allows omitting an
        extra return value coercion, as the target return type and the
        source return type will be the same.
        """
        sig = (Callable)function_type(act_as_func_def)