From 78caf8290c56e9fc6ca0d55962fb5add2f7b677d Mon Sep 17 00:00:00 2001 From: blueloveTH Date: Thu, 13 Feb 2025 16:18:02 +0800 Subject: [PATCH] Update array2d.pyi --- include/typings/array2d.pyi | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/include/typings/array2d.pyi b/include/typings/array2d.pyi index 48d2cb62..f8845932 100644 --- a/include/typings/array2d.pyi +++ b/include/typings/array2d.pyi @@ -62,22 +62,22 @@ class array2d_like[T]: # algorithms def count(self, value: T) -> int: - """Counts the number of cells with the given value.""" + """Count the number of cells with the given value.""" def count_neighbors(self, value: T, neighborhood: Neighborhood) -> array2d[int]: - """Counts the number of neighbors with the given value for each cell.""" + """Count the number of neighbors with the given value for each cell.""" def get_bounding_rect(self, value: T) -> tuple[int, int, int, int]: - """Gets the bounding rectangle of the given value. + """Get the bounding rectangle of the given value. Returns a tuple `(x, y, width, height)` or raise `ValueError` if the value is not found. """ def convolve(self: array2d_like[int], kernel: array2d_like[int], padding: int) -> array2d[int]: - """Convolves the array with the given kernel.""" + """Convolve the array with the given kernel.""" def get_connected_components(self, value: T, neighborhood: Neighborhood) -> tuple[array2d[int], int]: - """Gets connected components of the grid. + """Get connected components of the grid. Returns the `visited` array and the number of connected components, where `0` means unvisited, and non-zero means the index of the connected component. @@ -119,7 +119,9 @@ class chunked_array2d[T, TContext]: def clear(self) -> None: ... - def world_to_chunk(self, world_pos: vec2i) -> tuple[vec2i, vec2i]: ... + def world_to_chunk(self, world_pos: vec2i) -> tuple[vec2i, vec2i]: + """Convert world position to chunk position and local position.""" + def add_chunk(self, chunk_pos: vec2i) -> TContext: ... def remove_chunk(self, chunk_pos: vec2i) -> bool: ... def get_context(self, chunk_pos: vec2i) -> TContext | None: ...