From a0da7455dffc4d333578bf5b5b6440cde16d1b83 Mon Sep 17 00:00:00 2001 From: Dysta Date: Sun, 30 Aug 2026 21:24:42 +0200 Subject: [PATCH] feat: upgrade typing support --- dofutils/maps/path/pathfinder.py | 13 +++++++------ dofutils/py.typed | 1 + 2 files changed, 8 insertions(+), 6 deletions(-) create mode 100644 dofutils/py.typed diff --git a/dofutils/maps/path/pathfinder.py b/dofutils/maps/path/pathfinder.py index c932b8b..36cc61d 100644 --- a/dofutils/maps/path/pathfinder.py +++ b/dofutils/maps/path/pathfinder.py @@ -3,6 +3,7 @@ import heapq from collections.abc import Callable, Iterable from itertools import count +from typing import Self from dofutils.maps.constant import Direction from dofutils.maps.coordinate_cell import CoordinateCell @@ -23,27 +24,27 @@ def __init__(self, decoder: PathDecoder): self._explored_cell_limit = float("inf") self._add_first_cell = True - def target_distance(self, distance: int) -> Pathfinder: + def target_distance(self, distance: int) -> Self: self._target_distance = distance return self - def walkable_predicate(self, predicate: Callable[[CoordinateCell], bool]) -> Pathfinder: + def walkable_predicate(self, predicate: Callable[[CoordinateCell], bool]) -> Self: self._walkable_predicate = predicate return self - def cell_weight_function(self, function: Callable[[CoordinateCell], int]) -> Pathfinder: + def cell_weight_function(self, function: Callable[[CoordinateCell], int]) -> Self: self._cell_weight = function return self - def with_directions(self, directions: Iterable[Direction]) -> Pathfinder: + def with_directions(self, directions: Iterable[Direction]) -> Self: self._directions = directions return self - def explored_cell_limit(self, limit: int) -> Pathfinder: + def explored_cell_limit(self, limit: int) -> Self: self._explored_cell_limit = limit return self - def include_first_cell(self, include: bool) -> Pathfinder: + def include_first_cell(self, include: bool) -> Self: self._add_first_cell = include return self diff --git a/dofutils/py.typed b/dofutils/py.typed new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/dofutils/py.typed @@ -0,0 +1 @@ +