| 1 |
from collections.abc import Callable, Hashable |
| 2 |
from typing import Any, SupportsInt, TypeVar |
| 3 |
from typing_extensions import TypeAlias |
| 4 |
|
| 5 |
_T = TypeVar("_T") |
| 6 |
_Reduce: TypeAlias = tuple[Callable[..., _T], tuple[Any, ...]] | tuple[Callable[..., _T], tuple[Any, ...], Any | None] |
| 7 |
|
| 8 |
__all__ = ["pickle", "constructor", "add_extension", "remove_extension", "clear_extension_cache"] |
| 9 |
|
| 10 |
def pickle( |
| 11 |
ob_type: type[_T], |
| 12 |
pickle_function: Callable[[_T], str | _Reduce[_T]], |
| 13 |
constructor_ob: Callable[[_Reduce[_T]], _T] | None = None, |
| 14 |
) -> None: ... |
| 15 |
def constructor(object: Callable[[_Reduce[_T]], _T]) -> None: ... |
| 16 |
def add_extension(module: Hashable, name: Hashable, code: SupportsInt) -> None: ... |
| 17 |
def remove_extension(module: Hashable, name: Hashable, code: int) -> None: ... |
| 18 |
def clear_extension_cache() -> None: ... |
| 19 |
|
| 20 |
_DispatchTableType: TypeAlias = dict[type, Callable[[Any], str | _Reduce[Any]]] |
| 21 |
dispatch_table: _DispatchTableType |