-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
12 changed files
with
347 additions
and
191 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
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,84 @@ | ||
from _typeshed import structseq | ||
from typing import Final, Literal, SupportsIndex, final | ||
from typing_extensions import Buffer, Self | ||
|
||
class ChannelError(RuntimeError): ... | ||
class ChannelClosedError(ChannelError): ... | ||
class ChannelEmptyError(ChannelError): ... | ||
class ChannelNotEmptyError(ChannelError): ... | ||
class ChannelNotFoundError(ChannelError): ... | ||
|
||
# Mark as final, since instantiating ChannelID is not supported. | ||
@final | ||
class ChannelID: | ||
@property | ||
def end(self) -> Literal["send", "recv", "both"]: ... | ||
@property | ||
def send(self) -> Self: ... | ||
@property | ||
def recv(self) -> Self: ... | ||
def __eq__(self, other: object) -> bool: ... | ||
def __ge__(self, other: ChannelID) -> bool: ... | ||
def __gt__(self, other: ChannelID) -> bool: ... | ||
def __hash__(self) -> int: ... | ||
def __index__(self) -> int: ... | ||
def __int__(self) -> int: ... | ||
def __le__(self, other: ChannelID) -> bool: ... | ||
def __lt__(self, other: ChannelID) -> bool: ... | ||
def __ne__(self, other: object) -> bool: ... | ||
|
||
@final | ||
class ChannelInfo(structseq[int], tuple[bool, bool, bool, int, int, int, int, int]): | ||
__match_args__: Final = ( | ||
"open", | ||
"closing", | ||
"closed", | ||
"count", | ||
"num_interp_send", | ||
"num_interp_send_released", | ||
"num_interp_recv", | ||
"num_interp_recv_released", | ||
) | ||
@property | ||
def open(self) -> bool: ... | ||
@property | ||
def closing(self) -> bool: ... | ||
@property | ||
def closed(self) -> bool: ... | ||
@property | ||
def count(self) -> int: ... # type: ignore[override] | ||
@property | ||
def num_interp_send(self) -> int: ... | ||
@property | ||
def num_interp_send_released(self) -> int: ... | ||
@property | ||
def num_interp_recv(self) -> int: ... | ||
@property | ||
def num_interp_recv_released(self) -> int: ... | ||
@property | ||
def num_interp_both(self) -> int: ... | ||
@property | ||
def num_interp_both_recv_released(self) -> int: ... | ||
@property | ||
def num_interp_both_send_released(self) -> int: ... | ||
@property | ||
def num_interp_both_released(self) -> int: ... | ||
@property | ||
def recv_associated(self) -> bool: ... | ||
@property | ||
def recv_released(self) -> bool: ... | ||
@property | ||
def send_associated(self) -> bool: ... | ||
@property | ||
def send_released(self) -> bool: ... | ||
|
||
def create() -> ChannelID: ... | ||
def destroy(cid: SupportsIndex) -> None: ... | ||
def list_all() -> list[ChannelID]: ... | ||
def list_interpreters(cid: SupportsIndex, *, send: bool) -> list[int]: ... | ||
def send(cid: SupportsIndex, obj: object, *, blocking: bool = True, timeout: float | None = None) -> None: ... | ||
def send_buffer(cid: SupportsIndex, obj: Buffer, *, blocking: bool = True, timeout: float | None = None) -> None: ... | ||
def recv(cid: SupportsIndex, default: object = ...) -> object: ... | ||
def close(cid: SupportsIndex, *, send: bool = False, recv: bool = False) -> None: ... | ||
def get_info(cid: SupportsIndex) -> ChannelInfo: ... | ||
def release(cid: SupportsIndex, *, send: bool = False, recv: bool = False, force: bool = False) -> None: ... |
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
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
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
Oops, something went wrong.