From 2f305e3536b7eb22ae83b864db3d2a17ff5bf80d Mon Sep 17 00:00:00 2001 From: Belowsky Date: Wed, 8 Oct 2025 19:27:31 -0400 Subject: [PATCH] syntax refactoring --- part1/echobot.py | 2 +- part2/dbhelper.py | 11 ++--------- part2/todobot.py | 2 +- 3 files changed, 4 insertions(+), 11 deletions(-) diff --git a/part1/echobot.py b/part1/echobot.py index 438401f..4034e79 100644 --- a/part1/echobot.py +++ b/part1/echobot.py @@ -69,4 +69,4 @@ def main(): if __name__ == '__main__': - main() \ No newline at end of file + main() diff --git a/part2/dbhelper.py b/part2/dbhelper.py index 8c6ed14..60215cc 100644 --- a/part2/dbhelper.py +++ b/part2/dbhelper.py @@ -9,7 +9,7 @@ def __init__(self, dbname="todo.sqlite"): def setup(self): tblstmt = "CREATE TABLE IF NOT EXISTS items (description text, owner text)" - itemidx = "CREATE INDEX IF NOT EXISTS itemIndex ON items (description ASC)" + itemidx = "CREATE INDEX IF NOT EXISTS itemIndex ON items (description ASC)" ownidx = "CREATE INDEX IF NOT EXISTS ownIndex ON items (owner ASC)" self.conn.execute(tblstmt) self.conn.execute(itemidx) @@ -24,7 +24,7 @@ def add_item(self, item_text, owner): def delete_item(self, item_text, owner): stmt = "DELETE FROM items WHERE description = (?) AND owner = (?)" - args = (item_text, owner ) + args = (item_text, owner) self.conn.execute(stmt, args) self.conn.commit() @@ -32,10 +32,3 @@ def get_items(self, owner): stmt = "SELECT description FROM items WHERE owner = (?)" args = (owner, ) return [x[0] for x in self.conn.execute(stmt, args)] - - - - - - - diff --git a/part2/todobot.py b/part2/todobot.py index 4b25693..c90829d 100644 --- a/part2/todobot.py +++ b/part2/todobot.py @@ -73,7 +73,7 @@ def get_last_chat_id_and_text(updates): def build_keyboard(items): keyboard = [[item] for item in items] - reply_markup = {"keyboard":keyboard, "one_time_keyboard": True} + reply_markup = {"keyboard": keyboard, "one_time_keyboard": True} return json.dumps(reply_markup)