Skip to content

Commit

Permalink
feature: make _Restorable separator its own variable to increase read…
Browse files Browse the repository at this point in the history
…ability
  • Loading branch information
mecaneer23 committed Jan 31, 2024
1 parent 01eaefd commit 1988d5b
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/class_history.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,18 @@


class _Restorable:
SEPARATOR = " |SEP|"

def __init__(self, todos: Todos, selected: int) -> None:
self.stored: str = " |SEP|".join([todo.text for todo in todos])
self.stored: str = self.SEPARATOR.join([todo.text for todo in todos])
self.selected: int = selected

def get(self) -> TodoList:
stored = self.stored.split(" |SEP|")
stored = self.stored.split(self.SEPARATOR)
return TodoList(Todos([Todo(line) for line in stored]), self.selected)

def __repr__(self) -> str:
return self.stored.replace(" |SEP|", ", ") + f": {self.selected}"
return self.stored.replace(self.SEPARATOR, ", ") + f": {self.selected}"


class UndoRedo:
Expand Down

0 comments on commit 1988d5b

Please sign in to comment.