last one for real

This commit is contained in:
Raphael Jacobs 2022-02-23 04:54:27 +01:00
parent 77039d199c
commit 6be6817780
1 changed files with 6 additions and 4 deletions

View File

@ -87,7 +87,7 @@ class Markov(ABC):
"""Generate a random message from said group."""
pass
@abstractmethod
@abstractmethod
def delete(self, grp: int):
"""Deletes all messages from group"""
pass
@ -119,7 +119,7 @@ class MarkovLite(Markov):
log.debug(f"storing {text} from group {grp}")
cursor = self.conn.cursor()
try:
for word_pair in processwords(text):
self.insert_words(cursor, word_pair, grp)
@ -141,14 +141,16 @@ class MarkovLite(Markov):
log.info(f"Deleting all words for group {grp}")
sql = """DELETE FROM words WHERE group_id={grp}"""
sql = f"""DELETE FROM words WHERE group_id={grp}"""
cursor = self.conn.cursor()
cursor = self.conn.cursor()
cursor.execute(sql)
log.info(f"Words deleted.")
def status(self, grp: int) -> str:
words = self.get_worddict(grp)