Skip to content

tornado: add some types #5742

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Jul 11, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
65 changes: 35 additions & 30 deletions stubs/tornado/@python2/tornado/locks.pyi
Original file line number Diff line number Diff line change
@@ -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): ...

class BoundedSemaphore(Semaphore):
def __init__(self, value: int = ...): ...
def release(self): ...
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): ...

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: ...
7 changes: 6 additions & 1 deletion stubs/tornado/METADATA.toml
Original file line number Diff line number Diff line change
@@ -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