From cc15856426ce3f6feb0aeb2a8570f0fac88bdf4d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Piotr=20Ma=C5=9Blanka?= <piotr.maslanka@henrietta.com.pl> Date: Fri, 23 Jul 2021 17:52:39 +0200 Subject: [PATCH] added default parameter to `ThreadCollection` --- CHANGELOG.md | 1 + satella/__init__.py | 2 +- satella/coding/concurrent/thread_collection.py | 7 +++++-- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a9190299..0f535d16 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,3 +2,4 @@ * deprecated `call_and_return_stdout` * deprecated `retry(call_on_failure=)` +* added default parameter to `ThreadCollection` diff --git a/satella/__init__.py b/satella/__init__.py index c339b6e4..88c43039 100644 --- a/satella/__init__.py +++ b/satella/__init__.py @@ -1 +1 @@ -__version__ = '2.17.16a4' +__version__ = '2.17.16a5' diff --git a/satella/coding/concurrent/thread_collection.py b/satella/coding/concurrent/thread_collection.py index b4c5aade..bb1b9a16 100644 --- a/satella/coding/concurrent/thread_collection.py +++ b/satella/coding/concurrent/thread_collection.py @@ -72,8 +72,11 @@ class ThreadCollection: for thread in self.threads: thread.daemon = v - def __init__(self, threads: tp.Sequence[Thread]): - self.threads = list(threads) + def __init__(self, threads: tp.Optional[tp.Sequence[Thread]] = None): + if threads is None: + self.threads = [] + else: + self.threads = list(threads) or [] def append(self, thread: Thread) -> 'ThreadCollection': """ -- GitLab