From 72c12c66fa8dbdd94e6e31d0a96d41ae45491930 Mon Sep 17 00:00:00 2001 From: Trygve Aaberge Date: Tue, 31 Jan 2023 20:06:51 +0100 Subject: Simplify setting future_id --- slack/task.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/slack/task.py b/slack/task.py index 4899741..e61ddb6 100644 --- a/slack/task.py +++ b/slack/task.py @@ -42,10 +42,7 @@ class InvalidStateError(Exception): # Heavily inspired by https://github.com/python/cpython/blob/3.11/Lib/asyncio/futures.py class Future(Awaitable[T]): def __init__(self, future_id: Optional[str] = None): - if future_id is None: - self.id = str(uuid4()) - else: - self.id = future_id + self.id = future_id or str(uuid4()) self._state: Literal["PENDING", "CANCELLED", "FINISHED"] = "PENDING" self._result: T self._exception: Optional[BaseException] = None -- cgit