Skip to content

Commit c4df2e8

Browse files
Merge pull request #43 from python-thread/fix/parallel-processing-func-signature
Fix: parallel processing func signature
2 parents 72f2217 + 2cd0654 commit c4df2e8

File tree

2 files changed

+3
-5
lines changed

2 files changed

+3
-5
lines changed

src/thread/_types.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"""
66

77
from typing import Any, Literal, Callable, Union
8-
from typing_extensions import ParamSpec, TypeVar
8+
from typing_extensions import ParamSpec, TypeVar, Concatenate
99

1010

1111
# Descriptive Types
@@ -34,4 +34,4 @@
3434
HookFunction = Callable[[_Target_T], Union[Any, None]]
3535

3636
_Dataset_T = TypeVar('_Dataset_T')
37-
DatasetFunction = Callable[[_Dataset_T], _Target_T]
37+
DatasetFunction = Callable[Concatenate[_Dataset_T, _Target_P], _Target_T]

src/thread/thread.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -346,7 +346,7 @@ class ParallelProcessing(Generic[_Target_P, _Target_T, _Dataset_T]):
346346

347347
def __init__(
348348
self,
349-
function: DatasetFunction[_Dataset_T, _Target_T],
349+
function: DatasetFunction[_Dataset_T, _Target_P, _Target_T],
350350
dataset: Sequence[_Dataset_T],
351351
max_threads: int = 8,
352352
*overflow_args: Overflow_In,
@@ -507,8 +507,6 @@ def start(self) -> None:
507507
i: v for i, v in self.overflow_kwargs.items() if i != 'name' and i != 'args'
508508
}
509509

510-
print(parsed_args, self.overflow_args)
511-
512510
for i, data_chunk in enumerate(chunk_split(self.dataset, max_threads)):
513511
chunk_thread = Thread(
514512
target=self.function,

0 commit comments

Comments
 (0)