Skip to content

Commit

Permalink
Merge pull request #43 from python-thread/fix/parallel-processing-fun…
Browse files Browse the repository at this point in the history
…c-signature

Fix: parallel processing func signature
  • Loading branch information
caffeine-addictt committed Feb 27, 2024
2 parents 72f2217 + 2cd0654 commit c4df2e8
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/thread/_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"""

from typing import Any, Literal, Callable, Union
from typing_extensions import ParamSpec, TypeVar
from typing_extensions import ParamSpec, TypeVar, Concatenate


# Descriptive Types
Expand Down Expand Up @@ -34,4 +34,4 @@
HookFunction = Callable[[_Target_T], Union[Any, None]]

_Dataset_T = TypeVar('_Dataset_T')
DatasetFunction = Callable[[_Dataset_T], _Target_T]
DatasetFunction = Callable[Concatenate[_Dataset_T, _Target_P], _Target_T]
4 changes: 1 addition & 3 deletions src/thread/thread.py
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,7 @@ class ParallelProcessing(Generic[_Target_P, _Target_T, _Dataset_T]):

def __init__(
self,
function: DatasetFunction[_Dataset_T, _Target_T],
function: DatasetFunction[_Dataset_T, _Target_P, _Target_T],
dataset: Sequence[_Dataset_T],
max_threads: int = 8,
*overflow_args: Overflow_In,
Expand Down Expand Up @@ -507,8 +507,6 @@ def start(self) -> None:
i: v for i, v in self.overflow_kwargs.items() if i != 'name' and i != 'args'
}

print(parsed_args, self.overflow_args)

for i, data_chunk in enumerate(chunk_split(self.dataset, max_threads)):
chunk_thread = Thread(
target=self.function,
Expand Down

0 comments on commit c4df2e8

Please sign in to comment.