From b112c20dadfa7e5d15909fd0b189949a6f04a6c7 Mon Sep 17 00:00:00 2001 From: Rune Tynan Date: Tue, 29 Oct 2019 22:52:05 -0400 Subject: [PATCH] Copyreg stubs (#3387) --- stdlib/2/copy_reg.pyi | 14 ++++++++++++++ stdlib/3/copyreg.pyi | 14 ++++++++++++++ tests/check_consistent.py | 1 + 3 files changed, 29 insertions(+) create mode 100644 stdlib/2/copy_reg.pyi create mode 100644 stdlib/3/copyreg.pyi diff --git a/stdlib/2/copy_reg.pyi b/stdlib/2/copy_reg.pyi new file mode 100644 index 000000000..a64a82c70 --- /dev/null +++ b/stdlib/2/copy_reg.pyi @@ -0,0 +1,14 @@ + +from typing import TypeVar, Callable, Union, Tuple, Any, Optional, SupportsInt, Hashable, List + + +_Type = TypeVar("_Type", bound=type) +_Reduce = Union[Tuple[Callable[..., _Type], Tuple[Any, ...]], Tuple[Callable[..., _Type], Tuple[Any, ...], Optional[Any]]] + +__all__: List[str] + +def pickle(ob_type: _Type, pickle_function: Callable[[_Type], Union[str, _Reduce[_Type]]], constructor_ob: Optional[Callable[[_Reduce[_Type]], _Type]] = ...) -> None: ... +def constructor(object: Callable[[_Reduce[_Type]], _Type]) -> None: ... +def add_extension(module: Hashable, name: Hashable, code: SupportsInt) -> None: ... +def remove_extension(module: Hashable, name: Hashable, code: int) -> None: ... +def clear_extension_cache() -> None: ... diff --git a/stdlib/3/copyreg.pyi b/stdlib/3/copyreg.pyi new file mode 100644 index 000000000..a64a82c70 --- /dev/null +++ b/stdlib/3/copyreg.pyi @@ -0,0 +1,14 @@ + +from typing import TypeVar, Callable, Union, Tuple, Any, Optional, SupportsInt, Hashable, List + + +_Type = TypeVar("_Type", bound=type) +_Reduce = Union[Tuple[Callable[..., _Type], Tuple[Any, ...]], Tuple[Callable[..., _Type], Tuple[Any, ...], Optional[Any]]] + +__all__: List[str] + +def pickle(ob_type: _Type, pickle_function: Callable[[_Type], Union[str, _Reduce[_Type]]], constructor_ob: Optional[Callable[[_Reduce[_Type]], _Type]] = ...) -> None: ... +def constructor(object: Callable[[_Reduce[_Type]], _Type]) -> None: ... +def add_extension(module: Hashable, name: Hashable, code: SupportsInt) -> None: ... +def remove_extension(module: Hashable, name: Hashable, code: int) -> None: ... +def clear_extension_cache() -> None: ... diff --git a/tests/check_consistent.py b/tests/check_consistent.py index 909e37081..12659db04 100755 --- a/tests/check_consistent.py +++ b/tests/check_consistent.py @@ -27,6 +27,7 @@ consistent_files = [ {'stdlib/3/pathlib.pyi', 'third_party/2/pathlib2.pyi'}, {'stdlib/3.7/contextvars.pyi', 'third_party/3/contextvars.pyi'}, {'stdlib/3/ipaddress.pyi', 'third_party/2/ipaddress.pyi'}, + {'stdlib/2/copy_reg.pyi', 'stdlib/3/copyreg.pyi'}, ] def main():