This repository has been archived by the owner on Nov 22, 2022. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add static annotations for accumulators
- Loading branch information
Showing
2 changed files
with
35 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
from typing import Any, List, Optional, TypeVar, Union | ||
from typing_extensions import Protocol | ||
|
||
|
||
class SupportsIAdd(Protocol): | ||
def __iadd__(self, other: SupportsIAdd) -> SupportsIAdd: ... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,37 +1,45 @@ | ||
# Stubs for pyspark.accumulators (Python 3.7) | ||
# | ||
# NOTE: This dynamically typed stub was automatically generated by stubgen. | ||
|
||
from typing import Callable, Generic, Tuple, Type, TypeVar | ||
|
||
import socketserver.BaseRequestHandler # type: ignore | ||
|
||
from pyspark._typing import SupportsIAdd | ||
|
||
T = TypeVar("T") | ||
U = TypeVar("U", bound=SupportsIAdd) | ||
|
||
import socketserver as SocketServer | ||
from typing import Any | ||
|
||
class Accumulator: | ||
aid: Any = ... | ||
accum_param: Any = ... | ||
def __init__(self, aid: Any, value: Any, accum_param: Any) -> None: ... | ||
def __reduce__(self): ... | ||
class Accumulator(Generic[T]): | ||
aid = ... # type: int | ||
accum_param = ... # type: AccumulatorParam[T] | ||
def __init__(self, aid: int, value: T, accum_param: AccumulatorParam[T]) -> None: ... | ||
def __reduce__(self) -> Tuple[Callable[[int, int, AccumulatorParam[T]], Accumulator[T]], Tuple[int, int, AccumulatorParam[T]]]: ... | ||
@property | ||
def value(self): ... | ||
def value(self) -> T: ... | ||
@value.setter | ||
def value(self, value: Any) -> None: ... | ||
def add(self, term: Any) -> None: ... | ||
def __iadd__(self, term: Any): ... | ||
def value(self, value: T) -> None: ... | ||
def add(self, term: T) -> None: ... | ||
def __iadd__(self, term: T) -> Accumulator[T]: ... | ||
|
||
class AccumulatorParam: | ||
def zero(self, value: Any) -> None: ... | ||
def addInPlace(self, value1: Any, value2: Any) -> None: ... | ||
class AccumulatorParam(Generic[T]): | ||
def zero(self, value: T) -> T: ... | ||
def addInPlace(self, value1: T, value2: T) -> T: ... | ||
|
||
class AddingAccumulatorParam(AccumulatorParam): | ||
zero_value: Any = ... | ||
def __init__(self, zero_value: Any) -> None: ... | ||
def zero(self, value: Any): ... | ||
def addInPlace(self, value1: Any, value2: Any): ... | ||
class AddingAccumulatorParam(AccumulatorParam[U]): | ||
zero_value = ... # type: U | ||
def __init__(self, zero_value: U) -> None: ... | ||
def zero(self, value: U) -> U: ... | ||
def addInPlace(self, value1: U, value2: U) -> U: ... | ||
|
||
class _UpdateRequestHandler(SocketServer.StreamRequestHandler): | ||
def handle(self): ... | ||
def handle(self) -> None: ... | ||
|
||
class AccumulatorServer(SocketServer.TCPServer): | ||
auth_token: Any = ... | ||
def __init__(self, server_address: Any, RequestHandlerClass: Any, auth_token: Any) -> None: ... | ||
auth_token = ... # type: str | ||
def __init__(self, server_address: Tuple[str, int], RequestHandlerClass: Type[socketserver.BaseRequestHandler], auth_token: str) -> None: ... | ||
server_shutdown: bool = ... | ||
def shutdown(self) -> None: ... |