summaryrefslogtreecommitdiffstats
path: root/src/parser.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/parser.py')
-rw-r--r--src/parser.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/parser.py b/src/parser.py
index ba7d247..11bb0c6 100644
--- a/src/parser.py
+++ b/src/parser.py
@@ -32,14 +32,14 @@ from enum import Enum
from typing import TextIO, Iterator
from card import Card, getId
-def _getCard(front_lines: list[str], back_lines: list[str]) -> tuple[int, Card]:
+def _getCard(front_lines: list[str], back_lines: list[str]) -> tuple[str, Card]:
front_text = "".join(front_lines).strip()
back_text = "".join(back_lines).strip()
card = Card(front_text, back_text)
id = getId(card)
return id, card
-def _getCards(f: TextIO) -> Iterator[tuple[id, Card]]:
+def _getCards(f: TextIO) -> Iterator[tuple[str, Card]]:
class State(Enum):
PARSE_FRONT = 1,
PARSE_BACK = 2
@@ -90,14 +90,14 @@ def _getCards(f: TextIO) -> Iterator[tuple[id, Card]]:
yield _getCard(front_lines, back_lines)
-def parseFile(path: str) -> dict[int, Card]:
+def parseFile(path: str) -> dict[str, Card]:
"""
Parse a .fcard file and return a dictionary of Card instances indexed by ID.
"""
with open(path, "r") as f:
return {id : card for id, card in _getCards(f)}
-def parseFiles(paths: list[str]) -> dict[int, Card]:
+def parseFiles(paths: list[str]) -> dict[str, Card]:
"""
Parse a list of .fcard files and return a dictionary of Card instances indexed by ID.
"""