Skip to content

Commit c7acd05

Browse files
authored
Fix invalid Python type annotation and return types (#8772) (#8773)
1 parent 1230f00 commit c7acd05

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

python_bindings/src/halide/_generator_helpers.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ def _make_replacement(self, value: Any, r: Requirement) -> Any:
204204
else:
205205
return self._value
206206

207-
def _get_types_and_dimensions(self) -> (list[Type], int):
207+
def _get_types_and_dimensions(self) -> tuple[list[Type], int]:
208208
# Use dummy type-and-dimensions here so that the ctor won't fail due to undefined status
209209
return [Int(32)], 0
210210

@@ -216,10 +216,10 @@ def __init__(self, type: Optional[Type], dimensions: Optional[int]):
216216
dimensions = -1
217217
super().__init__(type, dimensions, _unique_name())
218218

219-
def _get_types_and_dimensions(self) -> (list[Type], int):
219+
def _get_types_and_dimensions(self) -> tuple[list[Type], int]:
220220
return _normalize_type_list(self.type()), self.dimensions()
221221

222-
def _get_direction_and_kind(self) -> (ArgInfoDirection, ArgInfoKind):
222+
def _get_direction_and_kind(self) -> tuple[ArgInfoDirection, ArgInfoKind]:
223223
return ArgInfoDirection.Input, ArgInfoKind.Buffer
224224

225225
def _make_replacement(self, value: Any, r: Requirement) -> ImageParam:
@@ -248,10 +248,10 @@ def __init__(self, type: Optional[Type]):
248248
type = _sanitize_type(type)
249249
super().__init__(type, _unique_name())
250250

251-
def _get_types_and_dimensions(self) -> (list[Type], int):
251+
def _get_types_and_dimensions(self) -> tuple[list[Type], int]:
252252
return _normalize_type_list(self.type()), 0
253253

254-
def _get_direction_and_kind(self) -> (ArgInfoDirection, ArgInfoKind):
254+
def _get_direction_and_kind(self) -> tuple[ArgInfoDirection, ArgInfoKind]:
255255
return ArgInfoDirection.Input, ArgInfoKind.Scalar
256256

257257
def _make_replacement(self, value: Any, r: Requirement) -> Param:
@@ -285,10 +285,10 @@ def __init__(self, types: Optional[Type], dimensions: Optional[int]):
285285
self._types = types
286286
self._dimensions = dimensions
287287

288-
def _get_types_and_dimensions(self) -> (list[Type], int):
288+
def _get_types_and_dimensions(self) -> tuple[list[Type], int]:
289289
return self._types, self._dimensions
290290

291-
def _get_direction_and_kind(self) -> (ArgInfoDirection, ArgInfoKind):
291+
def _get_direction_and_kind(self) -> tuple[ArgInfoDirection, ArgInfoKind]:
292292
return ArgInfoDirection.Output, ArgInfoKind.Buffer
293293

294294
def _make_replacement(self, value: Any, r: Requirement) -> Func:
@@ -640,7 +640,7 @@ def _advance_to_io_created(self):
640640

641641
def _set_io_types_and_dimensions_from_gp(
642642
self, name: str, current_types: list[Type], current_dimensions: int
643-
) -> (list[Type], int):
643+
) -> tuple[list[Type], int]:
644644
new_types = current_types
645645
new_dimensions = current_dimensions
646646

@@ -888,11 +888,11 @@ def generator_impl(cls):
888888
return generator_impl
889889

890890

891-
def funcs(names: str) -> tuple(Func):
891+
def funcs(names: str) -> tuple[Func, ...]:
892892
"""Given a space-delimited string, create a Func for each substring and return as a tuple."""
893-
return (Func(n) for n in names.split(" "))
893+
return tuple(Func(n) for n in names.split(" "))
894894

895895

896-
def vars(names: str) -> tuple(Var):
896+
def vars(names: str) -> tuple[Var, ...]:
897897
"""Given a space-delimited string, create a Var for each substring and return as a tuple."""
898-
return (Var(n) for n in names.split(" "))
898+
return tuple(Var(n) for n in names.split(" "))

0 commit comments

Comments
 (0)