Mods
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import json
|
||||
from typing import TYPE_CHECKING
|
||||
from typing import TYPE_CHECKING, Any
|
||||
|
||||
from .config import Config
|
||||
|
||||
@@ -9,18 +11,18 @@ if TYPE_CHECKING:
|
||||
|
||||
class Storage:
|
||||
@staticmethod
|
||||
def get_ants() -> None:
|
||||
def get_ants() -> Any:
|
||||
with Config.ants_json.open() as file:
|
||||
return json.load(file)
|
||||
|
||||
@staticmethod
|
||||
def save_ants(ants: list["Ant"]) -> None:
|
||||
def save_ants(ants: list[Ant]) -> None:
|
||||
objs = [ant.to_dict() for ant in ants]
|
||||
|
||||
with Config.ants_json.open("w") as file:
|
||||
json.dump(objs, file)
|
||||
|
||||
@staticmethod
|
||||
def get_names() -> None:
|
||||
def get_names() -> Any:
|
||||
with Config.names_json.open() as file:
|
||||
return json.load(file)
|
||||
return json.load(file)
|
||||
|
Reference in New Issue
Block a user