mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-09 05:24:52 +08:00
Replace various Incompletes in stdlib (#11673)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
This commit is contained in:
@@ -2,7 +2,7 @@ import threading
|
||||
from _typeshed import ConvertibleToInt, Incomplete, Unused
|
||||
from collections.abc import Callable, Iterable, Mapping, MutableMapping, Sequence
|
||||
from logging import Logger, _Level as _LoggingLevel
|
||||
from typing import Any
|
||||
from typing import Any, Generic, TypeVar, overload
|
||||
|
||||
__all__ = [
|
||||
"sub_debug",
|
||||
@@ -22,6 +22,9 @@ __all__ = [
|
||||
"SUBWARNING",
|
||||
]
|
||||
|
||||
_T = TypeVar("_T")
|
||||
_R_co = TypeVar("_R_co", default=Any, covariant=True)
|
||||
|
||||
NOTSET: int
|
||||
SUBDEBUG: int
|
||||
DEBUG: int
|
||||
@@ -42,13 +45,29 @@ def is_abstract_socket_namespace(address: str | bytes | None) -> bool: ...
|
||||
abstract_sockets_supported: bool
|
||||
|
||||
def get_temp_dir() -> str: ...
|
||||
def register_after_fork(obj, func: Callable[[Incomplete], object]) -> None: ...
|
||||
def register_after_fork(obj: _T, func: Callable[[_T], object]) -> None: ...
|
||||
|
||||
class Finalize:
|
||||
class Finalize(Generic[_R_co]):
|
||||
# "args" and "kwargs" are passed as arguments to "callback".
|
||||
@overload
|
||||
def __init__(
|
||||
self,
|
||||
obj: Incomplete | None,
|
||||
callback: Callable[..., Incomplete],
|
||||
obj: None,
|
||||
callback: Callable[..., _R_co],
|
||||
*,
|
||||
args: Sequence[Any] = (),
|
||||
kwargs: Mapping[str, Any] | None = None,
|
||||
exitpriority: int,
|
||||
) -> None: ...
|
||||
@overload
|
||||
def __init__(
|
||||
self, obj: None, callback: Callable[..., _R_co], args: Sequence[Any], kwargs: Mapping[str, Any] | None, exitpriority: int
|
||||
) -> None: ...
|
||||
@overload
|
||||
def __init__(
|
||||
self,
|
||||
obj: Any,
|
||||
callback: Callable[..., _R_co],
|
||||
args: Sequence[Any] = (),
|
||||
kwargs: Mapping[str, Any] | None = None,
|
||||
exitpriority: int | None = None,
|
||||
@@ -59,7 +78,7 @@ class Finalize:
|
||||
_finalizer_registry: MutableMapping[Incomplete, Incomplete] = {},
|
||||
sub_debug: Callable[..., object] = ...,
|
||||
getpid: Callable[[], int] = ...,
|
||||
): ...
|
||||
) -> _R_co: ...
|
||||
def cancel(self) -> None: ...
|
||||
def still_active(self) -> bool: ...
|
||||
|
||||
|
||||
Reference in New Issue
Block a user