Fixed (most) mypy warnings
This commit is contained in:
parent
ea5f283c32
commit
b7ccb7c2cc
@ -8,7 +8,7 @@
|
|||||||
import matplotlib.pyplot as plt
|
import matplotlib.pyplot as plt
|
||||||
import numpy as np
|
import numpy as np
|
||||||
import time
|
import time
|
||||||
from typing import Optional
|
from typing import Optional, NewType
|
||||||
from abc import ABC, abstractmethod
|
from abc import ABC, abstractmethod
|
||||||
from queue import Queue
|
from queue import Queue
|
||||||
|
|
||||||
@ -16,7 +16,8 @@ from queue import Queue
|
|||||||
# Type and interfaces definition
|
# Type and interfaces definition
|
||||||
#
|
#
|
||||||
|
|
||||||
type Point2D = tuple[int, int] # tuple(x, y)
|
Point2D = NewType("Point2D", tuple[int, int])
|
||||||
|
# type Point2D = tuple[int, int] # tuple(x, y)
|
||||||
type Path = list[Point2D]
|
type Path = list[Point2D]
|
||||||
|
|
||||||
class Map:
|
class Map:
|
||||||
@ -55,7 +56,7 @@ class Map:
|
|||||||
for y in range(-1,2):
|
for y in range(-1,2):
|
||||||
if x == 0 and y == 0:
|
if x == 0 and y == 0:
|
||||||
continue
|
continue
|
||||||
p = (x + x_center, y + y_center)
|
p = Point2D((x + x_center, y + y_center))
|
||||||
if self.IsPointValid(p):
|
if self.IsPointValid(p):
|
||||||
points.append(p)
|
points.append(p)
|
||||||
return points
|
return points
|
||||||
@ -253,8 +254,8 @@ def main():
|
|||||||
# Define the map and start/stop points
|
# Define the map and start/stop points
|
||||||
m = Map(15,10)
|
m = Map(15,10)
|
||||||
m.Randomize()
|
m.Randomize()
|
||||||
starting_point: Point2D = (14,1)
|
starting_point: Point2D = Point2D((14,8))
|
||||||
end_point: Point2D = (0,9)
|
end_point: Point2D = Point2D((1,1))
|
||||||
|
|
||||||
path_finder_classes: list[type[PathFinderBase]] = [
|
path_finder_classes: list[type[PathFinderBase]] = [
|
||||||
DFS,
|
DFS,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user