Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 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
2 changes: 1 addition & 1 deletion stubs/Pillow/PIL/Image.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ class Image:
def __exit__(self, *args: Any) -> None: ...
def close(self) -> None: ...
def __eq__(self, other: object) -> bool: ...
def __array__(self) -> Any: ... # returns numpy.array()
def __array__(self, dtype=...) -> Any: ... # returns numpy.array()
def __getstate__(self) -> _ImageState: ...
def __setstate__(self, state: _ImageState) -> None: ...
def tobytes(self, encoder_name: str = ..., *args) -> bytes: ...
Expand Down
41 changes: 22 additions & 19 deletions stubs/tornado/@python2/tornado/locks.pyi
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
from typing import Any, Optional
from types import TracebackType
from typing import Any, NoReturn, Optional, Type

class _TimeoutGarbageCollector:
def __init__(self): ...
def __init__(self) -> None: ...

class Condition(_TimeoutGarbageCollector):
io_loop: Any
Expand All @@ -11,35 +12,37 @@ class Condition(_TimeoutGarbageCollector):
def notify_all(self): ...

class Event:
def __init__(self): ...
def is_set(self): ...
def __init__(self) -> None: ...
def is_set(self) -> bool: ...
def set(self): ...
def clear(self): ...
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 __init__(self, value: int = ...) -> None: ...
def release(self) -> None: ...
def acquire(self, timeout: Optional[Any] = ...): ...
def __enter__(self): ...
def __enter__(self) -> NoReturn: ...
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The implementation is:

    def __enter__(self) -> None:
        raise RuntimeError("Use 'async with' instead of 'with' for Semaphore")

It might be better to delete this, so that you get an error when type-checking, not at runtime.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

__exit__: Any
def __aenter__(self): ...
def __aexit__(self, typ, value, tb): ...
def __aenter__(self) -> None: ...
def __aexit__(
self, typ: Optional[Type[BaseException]], value: Optional[BaseException], tb: Optional[TracebackType]
) -> None: ...

class BoundedSemaphore(Semaphore):
def __init__(self, value: int = ...): ...
def release(self): ...
class BoundedSemaphore(Semaphore): ...

class Lock:
def __init__(self): ...
def __init__(self) -> None: ...
def acquire(self, timeout: Optional[Any] = ...): ...
def release(self): ...
def __enter__(self): ...
def release(self) -> None: ...
def __enter__(self) -> NoReturn: ...
__exit__: Any
def __aenter__(self): ...
def __aexit__(self, typ, value, tb): ...
def __aenter__(self) -> None: ...
def __aexit__(
self, typ: Optional[Type[BaseException]], value: Optional[BaseException], tb: Optional[TracebackType]
) -> None: ...
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My comments for class Semaphore apply here too.