From e92baf311b24d1a69035c6346f2ad7b90e4ca38c Mon Sep 17 00:00:00 2001 From: alex Date: Fri, 3 Jan 2025 11:40:48 +0100 Subject: [PATCH] fix typings, runtimewarning on none --- asyncz/stores/file.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/asyncz/stores/file.py b/asyncz/stores/file.py index d123ffe..7e1e7a0 100644 --- a/asyncz/stores/file.py +++ b/asyncz/stores/file.py @@ -48,12 +48,14 @@ def __init__( self.cleanup_directory = cleanup_directory self.suffix = suffix - def check_task_id(self, task_id) -> None: + def check_task_id(self, task_id: str | None) -> None: + if task_id is None: + raise RuntimeError("Task id is None") if task_id.startswith("."): - raise RuntimeError(f'Invalid character in task id: "{task_id}"') + raise RuntimeError(f'Invalid character in task id: "{task_id}".') for char in task_id: if char in self.forbidden_characters: - raise RuntimeError(f'Invalid character in task id: "{task_id}"') + raise RuntimeError(f'Invalid character in task id: "{task_id}".') def start(self, scheduler: Any, alias: str) -> None: """