From 52abd210cbd9c78861b4fec2b0b1a8794b5f1502 Mon Sep 17 00:00:00 2001 From: Alexandru Fikl Date: Sat, 13 Apr 2024 11:34:40 +0300 Subject: [PATCH] target: fix ASTBuilder.get_function_declaration annotations --- loopy/target/__init__.py | 2 +- loopy/target/pyopencl.py | 6 +++--- loopy/target/python.py | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/loopy/target/__init__.py b/loopy/target/__init__.py index be04d1008..9e8211a03 100644 --- a/loopy/target/__init__.py +++ b/loopy/target/__init__.py @@ -216,7 +216,7 @@ def get_function_definition( def get_function_declaration( self, codegen_state: CodeGenerationState, codegen_result: CodeGenerationResult, schedule_index: int - ) -> Tuple[Sequence[Tuple[str, str]], ASTType]: + ) -> Tuple[Sequence[Tuple[str, str]], Optional[ASTType]]: """Returns preambles and the AST for the function declaration.""" raise NotImplementedError diff --git a/loopy/target/pyopencl.py b/loopy/target/pyopencl.py index 40963a85e..2742e472b 100644 --- a/loopy/target/pyopencl.py +++ b/loopy/target/pyopencl.py @@ -633,7 +633,7 @@ def generate_value_arg_setup( from genpy import If, Raise, Statement as S, Suite - result: List[str] = [] + result: List[genpy.Generable] = [] gen = result.append buf_indices_and_args = [] @@ -717,7 +717,7 @@ def generate_array_arg_setup( from loopy.kernel.array import ArrayBase from genpy import Statement as S, Suite - result: List[str] = [] + result: List[genpy.Generable] = [] gen = result.append cl_indices_and_args: List[Union[int, str]] = [] @@ -787,7 +787,7 @@ def get_function_definition( def get_function_declaration( self, codegen_state: CodeGenerationState, codegen_result: CodeGenerationResult, schedule_index: int - ) -> Tuple[Sequence[Tuple[str, str]], genpy.Generable]: + ) -> Tuple[Sequence[Tuple[str, str]], Optional[genpy.Generable]]: # no such thing in Python return [], None diff --git a/loopy/target/python.py b/loopy/target/python.py index f93d2b44e..1940dab16 100644 --- a/loopy/target/python.py +++ b/loopy/target/python.py @@ -23,7 +23,7 @@ THE SOFTWARE. """ -from typing import Tuple, Sequence +from typing import Optional, Sequence, Tuple from pymbolic.mapper import Mapper from pymbolic.mapper.stringifier import StringifyMapper @@ -169,7 +169,7 @@ def ast_module(self): def get_function_declaration( self, codegen_state: CodeGenerationState, codegen_result: CodeGenerationResult, schedule_index: int - ) -> Tuple[Sequence[Tuple[str, str]], None]: + ) -> Tuple[Sequence[Tuple[str, str]], Optional[Generable]]: return [], None def get_function_definition(self, codegen_state, codegen_result,