Skip to content

Commit

Permalink
Optional CallbackResultType in minet.executors
Browse files Browse the repository at this point in the history
Fix #889
  • Loading branch information
Yomguithereal committed Apr 15, 2024
1 parent 67f6350 commit 752a4d7
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions minet/executors.py
Original file line number Diff line number Diff line change
Expand Up @@ -564,19 +564,19 @@ def request(
iterator: Iterable[ItemType],
*,
passthrough: Literal[False] = ...,
callback: Callable[[ItemType, str, Response], CallbackResultType],
callback: Callable[[ItemType, str, Response], Optional[CallbackResultType]],
**kwargs: Unpack[ExecutorRequestKwargs[ItemType]],
) -> Iterator[Tuple[AnyActualRequestResult[ItemType], CallbackResultType]]: ...
) -> Iterator[Tuple[AnyActualRequestResult[ItemType], Optional[CallbackResultType]]]: ...

@overload
def request(
self,
iterator: Iterable[ItemType],
*,
passthrough: Literal[True] = ...,
callback: Callable[[ItemType, str, Response], CallbackResultType],
callback: Callable[[ItemType, str, Response], Optional[CallbackResultType]],
**kwargs: Unpack[ExecutorRequestKwargs[ItemType]],
) -> Iterator[Tuple[AnyRequestResult[ItemType], CallbackResultType]]: ...
) -> Iterator[Tuple[AnyRequestResult[ItemType], Optional[CallbackResultType]]]: ...

def request(
self,
Expand All @@ -593,14 +593,14 @@ def request(
max_redirects: int = DEFAULT_FETCH_MAX_REDIRECTS,
known_encoding: Optional[str] = None,
callback: Optional[
Callable[[ItemType, str, Response], CallbackResultType]
Callable[[ItemType, str, Response], Optional[CallbackResultType]]
] = None,
passthrough: bool = False,
) -> Union[
Iterator[AnyRequestResult[ItemType]],
Iterator[AnyActualRequestResult[ItemType]],
Iterator[Tuple[AnyRequestResult[ItemType], CallbackResultType]],
Iterator[Tuple[AnyActualRequestResult[ItemType], CallbackResultType]],
Iterator[Tuple[AnyRequestResult[ItemType], Optional[CallbackResultType]]],
Iterator[Tuple[AnyActualRequestResult[ItemType], Optional[CallbackResultType]]],
]:
# TODO: validate
worker = HTTPWorker(
Expand Down Expand Up @@ -660,20 +660,20 @@ def resolve(
self,
iterator: Iterable[ItemType],
*,
callback: Callable[[ItemType, str, RedirectionStack], CallbackResultType],
callback: Callable[[ItemType, str, RedirectionStack], Optional[CallbackResultType]],
passthrough: Literal[False] = ...,
**kwargs: Unpack[ExecutorResolveKwargs[ItemType]],
) -> Iterator[Tuple[AnyActualResolveResult[ItemType], CallbackResultType]]: ...
) -> Iterator[Tuple[AnyActualResolveResult[ItemType], Optional[CallbackResultType]]]: ...

@overload
def resolve(
self,
iterator: Iterable[ItemType],
*,
callback: Callable[[ItemType, str, RedirectionStack], CallbackResultType],
callback: Callable[[ItemType, str, RedirectionStack], Optional[CallbackResultType]],
passthrough: Literal[True] = ...,
**kwargs: Unpack[ExecutorResolveKwargs[ItemType]],
) -> Iterator[Tuple[AnyResolveResult[ItemType], CallbackResultType]]: ...
) -> Iterator[Tuple[AnyResolveResult[ItemType], Optional[CallbackResultType]]]: ...

def resolve(
self,
Expand All @@ -692,14 +692,14 @@ def resolve(
infer_redirection: bool = False,
canonicalize: bool = False,
callback: Optional[
Callable[[ItemType, str, RedirectionStack], CallbackResultType]
Callable[[ItemType, str, RedirectionStack], Optional[CallbackResultType]]
] = None,
passthrough: bool = False,
) -> Union[
Iterator[AnyResolveResult[ItemType]],
Iterator[AnyActualResolveResult[ItemType]],
Iterator[Tuple[AnyResolveResult[ItemType], CallbackResultType]],
Iterator[Tuple[AnyActualResolveResult[ItemType], CallbackResultType]],
Iterator[Tuple[AnyResolveResult[ItemType], Optional[CallbackResultType]]],
Iterator[Tuple[AnyActualResolveResult[ItemType], Optional[CallbackResultType]]],
]:
# TODO: validate
worker = HTTPWorker(
Expand Down

0 comments on commit 752a4d7

Please sign in to comment.