tornado: add some types, set version (#5742)

This commit is contained in:
Jelle Zijlstra
2021-07-11 04:17:40 -07:00
committed by GitHub
parent 80591d9f99
commit a90573feb2
2 changed files with 40 additions and 30 deletions

View File

@@ -1,45 +1,50 @@
from typing import Any, Optional
from types import TracebackType
from typing import Any, Optional, Type
from .concurrent import Future
class _TimeoutGarbageCollector:
def __init__(self): ...
def __init__(self) -> None: ...
class Condition(_TimeoutGarbageCollector):
io_loop: Any
def __init__(self): ...
def wait(self, timeout: Optional[Any] = ...): ...
def notify(self, n: int = ...): ...
def notify_all(self): ...
def __init__(self) -> None: ...
def wait(self, timeout: Optional[float] = ...) -> Future: ...
def notify(self, n: int = ...) -> None: ...
def notify_all(self) -> None: ...
class Event:
def __init__(self): ...
def is_set(self): ...
def set(self): ...
def clear(self): ...
def __init__(self) -> None: ...
def is_set(self) -> bool: ...
def set(self) -> None: ...
def clear(self) -> None: ...
def wait(self, timeout: Optional[Any] = ...): ...
class _ReleasingContextManager:
def __init__(self, obj): ...
def __enter__(self): ...
def __init__(self, obj) -> None: ...
def __enter__(self) -> None: ...
def __exit__(self, exc_type, exc_val, exc_tb): ...
class Semaphore(_TimeoutGarbageCollector):
def __init__(self, value: int = ...): ...
def release(self): ...
def acquire(self, timeout: Optional[Any] = ...): ...
def __enter__(self): ...
__exit__: Any
def __aenter__(self): ...
def __aexit__(self, typ, value, tb): ...
def __init__(self, value: int = ...) -> None: ...
def release(self) -> None: ...
def acquire(self, timeout: Optional[float] = ...) -> Future: ...
# __enter__ and __exit__ exist but always throw an error, so we
# omit them to give better error message while type checking.
def __aenter__(self) -> Future: ...
def __aexit__(
self, typ: Optional[Type[BaseException]], value: Optional[BaseException], tb: Optional[TracebackType]
) -> Future: ...
class BoundedSemaphore(Semaphore):
def __init__(self, value: int = ...): ...
def release(self): ...
class BoundedSemaphore(Semaphore): ...
class Lock:
def __init__(self): ...
def acquire(self, timeout: Optional[Any] = ...): ...
def release(self): ...
def __enter__(self): ...
__exit__: Any
def __aenter__(self): ...
def __aexit__(self, typ, value, tb): ...
def __init__(self) -> None: ...
def acquire(self, timeout: Optional[float] = ...) -> Future: ...
def release(self) -> None: ...
# __enter__ and __exit__ exist but always throw an error, so we
# omit them to give better error message while type checking.
def __aenter__(self) -> Future: ...
def __aexit__(
self, typ: Optional[Type[BaseException]], value: Optional[BaseException], tb: Optional[TracebackType]
) -> Future: ...

View File

@@ -1,2 +1,7 @@
version = "0.1"
# tornado ships with types as of version 6, but
# we keep these stubs around for the benefit of
# Python 2 users (see #4412). Therefore, these
# stubs target version 5.1, the last to support
# Python 2.
version = "5.1"
python2 = true