Skip to content

Commit 9b21091

Browse files
Fix failing tests for python3.9
1 parent b76cedc commit 9b21091

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

src/thread/thread.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class ParallelProcessing: ...
2525
DatasetFunction, _Dataset_T,
2626
HookFunction
2727
)
28-
from typing_extensions import Generic
28+
from typing_extensions import Generic, Concatenate, ParamSpec
2929
from typing import (
3030
List,
3131
Callable, Optional, Union,
@@ -321,6 +321,7 @@ def start(self) -> None:
321321

322322

323323

324+
_P = ParamSpec('_P')
324325
class _ThreadWorker:
325326
progress: float
326327
thread: Thread
@@ -341,7 +342,7 @@ class ParallelProcessing(Generic[_Target_P, _Target_T, _Dataset_T]):
341342
_completed : int
342343

343344
status : ThreadStatus
344-
function : TargetFunction[..., List[_Target_T]]
345+
function : TargetFunction
345346
dataset : Sequence[Data_In]
346347
max_threads : int
347348

@@ -391,8 +392,8 @@ def __init__(
391392

392393
def _wrap_function(
393394
self,
394-
function: TargetFunction[[_Dataset_T], _Target_T]
395-
) -> TargetFunction[..., List[_Target_T]]:
395+
function: TargetFunction
396+
) -> TargetFunction:
396397
@wraps(function)
397398
def wrapper(index: int, data_chunk: Sequence[_Dataset_T], *args: _Target_P.args, **kwargs: _Target_P.kwargs) -> List[_Target_T]:
398399
computed: List[Data_Out] = []
@@ -512,6 +513,8 @@ def start(self) -> None:
512513
name_format = self.overflow_kwargs.get('name') and self.overflow_kwargs['name'] + '%s'
513514
self.overflow_kwargs = { i: v for i,v in self.overflow_kwargs.items() if i != 'name' and i != 'args' }
514515

516+
print(parsed_args, self.overflow_args)
517+
515518
for i, data_chunk in enumerate(chunk_split(self.dataset, max_threads)):
516519
chunk_thread = Thread(
517520
target = self.function,

0 commit comments

Comments
 (0)