Skip to content
Snippets Groups Projects
Commit 16c3fc47 authored by Florian Schröder's avatar Florian Schröder
Browse files

type hints

parent 4f068991
No related branches found
No related tags found
1 merge request!19Resolve "Add recipe yaml check + visualize recipes"
Pipeline #43958 passed
...@@ -145,7 +145,7 @@ class ServingWindow(Counter): ...@@ -145,7 +145,7 @@ class ServingWindow(Counter):
self, self,
pos, pos,
game_score: GameScore, game_score: GameScore,
meals: list[str], meals: set[str],
plate_dispenser: PlateDispenser = None, plate_dispenser: PlateDispenser = None,
): ):
self.game_score = game_score self.game_score = game_score
......
...@@ -77,7 +77,7 @@ class Item: ...@@ -77,7 +77,7 @@ class Item:
def extra_repr(self): def extra_repr(self):
return "" return ""
def can_combine(self, other): def can_combine(self, other) -> bool:
return False return False
def combine(self, other) -> Item | None: def combine(self, other) -> Item | None:
...@@ -106,7 +106,6 @@ class CookingEquipment(Item): ...@@ -106,7 +106,6 @@ class CookingEquipment(Item):
super().__init__(*args, **kwargs) super().__init__(*args, **kwargs)
self.transitions = transitions self.transitions = transitions
self.active_transition: Optional[dict] = None self.active_transition: Optional[dict] = None
# self.content: Item | list[Item] = [] # list if cooking, meal item when done
self.content_ready: Item | None = None self.content_ready: Item | None = None
self.content_list: list[Item] = [] self.content_list: list[Item] = []
...@@ -116,7 +115,7 @@ class CookingEquipment(Item): ...@@ -116,7 +115,7 @@ class CookingEquipment(Item):
for transition in self.transitions.values(): for transition in self.transitions.values():
transition["recipe"] = collections.Counter(transition["needs"]) transition["recipe"] = collections.Counter(transition["needs"])
def can_combine(self, other): def can_combine(self, other) -> bool:
# already cooking or nothing to combine # already cooking or nothing to combine
if other is None: if other is None:
return False return False
...@@ -134,7 +133,7 @@ class CookingEquipment(Item): ...@@ -134,7 +133,7 @@ class CookingEquipment(Item):
ingredients <= recipe["recipe"] for recipe in self.transitions.values() ingredients <= recipe["recipe"] for recipe in self.transitions.values()
) )
def combine(self, other): def combine(self, other) -> Item | None:
return_value = None return_value = None
if isinstance(other, CookingEquipment): if isinstance(other, CookingEquipment):
self.content_list.extend(other.content_list) self.content_list.extend(other.content_list)
...@@ -199,7 +198,7 @@ class CookingEquipment(Item): ...@@ -199,7 +198,7 @@ class CookingEquipment(Item):
class Plate(CookingEquipment): class Plate(CookingEquipment):
def __init__(self, transitions, clean, content=None, *args, **kwargs): def __init__(self, transitions, clean, *args, **kwargs):
self.clean = clean self.clean = clean
super().__init__( super().__init__(
name=self.create_name(), transitions=transitions, *args, **kwargs name=self.create_name(), transitions=transitions, *args, **kwargs
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment