aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTrygve Aaberge <trygveaa@gmail.com>2023-01-31 20:06:51 +0100
committerTrygve Aaberge <trygveaa@gmail.com>2024-02-18 11:32:53 +0100
commit72c12c66fa8dbdd94e6e31d0a96d41ae45491930 (patch)
tree09fa6376ed87c510256ea5050240a5bd96ca1f60
parent8805a2398e4a273ba22c172b3fc1254028834de2 (diff)
downloadwee-slack-72c12c66fa8dbdd94e6e31d0a96d41ae45491930.tar.gz
Simplify setting future_id
-rw-r--r--slack/task.py5
1 files changed, 1 insertions, 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