Clean up threading.pyi (#6525)

- Adds comments to aliases in the `threading` module to indicate that they're deprecated.
- Adds two missing aliases, for consistency.
- Closes #6494
This commit is contained in:
Alex Waygood
2021-12-07 00:21:27 +00:00
committed by GitHub
parent 72ee95bc0b
commit a69ef8f1ad
2 changed files with 7 additions and 5 deletions

View File

@@ -11,8 +11,9 @@ _T = TypeVar("_T")
__all__: list[str]
def active_count() -> int: ...
def activeCount() -> int: ... # deprecated alias for active_count()
def current_thread() -> Thread: ...
def currentThread() -> Thread: ...
def currentThread() -> Thread: ... # deprecated alias for current_thread()
def get_ident() -> int: ...
def enumerate() -> list[Thread]: ...
def main_thread() -> Thread: ...
@@ -55,14 +56,15 @@ class Thread:
def start(self) -> None: ...
def run(self) -> None: ...
def join(self, timeout: float | None = ...) -> None: ...
def getName(self) -> str: ...
def setName(self, name: str) -> None: ...
if sys.version_info >= (3, 8):
@property
def native_id(self) -> int | None: ... # only available on some platforms
def is_alive(self) -> bool: ...
if sys.version_info < (3, 9):
def isAlive(self) -> bool: ...
# the following methods are all deprecated
def getName(self) -> str: ...
def setName(self, name: str) -> None: ...
def isDaemon(self) -> bool: ...
def setDaemon(self, daemonic: bool) -> None: ...
@@ -102,7 +104,7 @@ class Condition:
def wait_for(self, predicate: Callable[[], _T], timeout: float | None = ...) -> _T: ...
def notify(self, n: int = ...) -> None: ...
def notify_all(self) -> None: ...
def notifyAll(self) -> None: ...
def notifyAll(self) -> None: ... # deprecated alias for notify_all()
class Semaphore:
def __init__(self, value: int = ...) -> None: ...
@@ -121,6 +123,7 @@ class BoundedSemaphore(Semaphore): ...
class Event:
def __init__(self) -> None: ...
def is_set(self) -> bool: ...
def isSet(self) -> bool: ... # deprecated alias for is_set()
def set(self) -> None: ...
def clear(self) -> None: ...
def wait(self, timeout: float | None = ...) -> bool: ...