aboutsummaryrefslogtreecommitdiffstats
path: root/hommaexceli_py
diff options
context:
space:
mode:
Diffstat (limited to 'hommaexceli_py')
-rw-r--r--hommaexceli_py/data_parser.py4
-rw-r--r--hommaexceli_py/sheets_client.py2
-rw-r--r--hommaexceli_py/telegram_client.py8
3 files changed, 9 insertions, 5 deletions
diff --git a/hommaexceli_py/data_parser.py b/hommaexceli_py/data_parser.py
index 92297b4..f72b05f 100644
--- a/hommaexceli_py/data_parser.py
+++ b/hommaexceli_py/data_parser.py
@@ -56,7 +56,7 @@ def _process_row(row: SheetsRow):
def process_rows(rows: list[SheetsRow]) -> list[ProcessedRow]:
- return list(map(_process_row, rows))
+ return [_process_row(row) for row in rows]
def _is_this_week(processed_row: ProcessedRow):
@@ -68,4 +68,4 @@ def _is_this_week(processed_row: ProcessedRow):
def filter_only_this_week(rows: list[ProcessedRow]) -> list[ProcessedRow]:
- return list(filter(_is_this_week, rows))
+ return [row for row in rows if _is_this_week(row)]
diff --git a/hommaexceli_py/sheets_client.py b/hommaexceli_py/sheets_client.py
index 95721b3..242dca8 100644
--- a/hommaexceli_py/sheets_client.py
+++ b/hommaexceli_py/sheets_client.py
@@ -86,7 +86,7 @@ def fetch_sheet_data(service: Resource) -> list[SheetsRow]:
rows = result.get("values", [])
logging.info(f"Fetched {len(rows)} rows of data")
- return list(map(_row_to_dataclass, rows))
+ return [_row_to_dataclass(row) for row in rows]
def update_sheet_last_done_column(
diff --git a/hommaexceli_py/telegram_client.py b/hommaexceli_py/telegram_client.py
index d11d876..a0f2af8 100644
--- a/hommaexceli_py/telegram_client.py
+++ b/hommaexceli_py/telegram_client.py
@@ -17,7 +17,11 @@ from functools import partial
chats_mem_cache = set()
-ALLOWED_USER_IDS = map(lambda id: int(id), getenv("TELEGRAM_USER_IDS", "").split(","))
+
+
+ALLOWED_USER_IDS = [
+ int(id) for id in getenv("TELEGRAM_USER_IDS", "").split(",") if len(id) > 0
+]
def _signal_handler(sig, frame):
@@ -42,7 +46,7 @@ def _callback_alarm(context: CallbackContext, sheets_service: Resource):
logging.info(f"Sending sheet data to chat id {chat_id}...")
if len(this_weeks_rows) > 0:
message = "Tällä viikolla tehtävät hommat:\n" + "\n".join(
- map(lambda task: f"{task.name} ({task.interval})", this_weeks_rows)
+ f"{task.name} ({task.interval})" for task in this_weeks_rows
)
else:
message = "Tällä viikolla ei toistuvia hommia! 🎉 "