10000 Improve protocol return types by srittau · Pull Request #7093 · python/typeshed · GitHub
[go: up one dir, main page]

Skip to content

Improve protocol return types #7093

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 4 commits into from
Feb 1, 2022
Merged
Changes from 1 commit
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
Next Next commit
Improve protocol return types
* Dunder comparisons must return bool.
* write() return type should be ignored.
  • Loading branch information
srittau committed Jan 31, 2022
commit 4feb6674519212fcdae5a50a364682f3445ad6ed
10 changes: 5 additions & 5 deletions stdlib/_typeshed/__init__.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -38,16 +38,16 @@ class SupportsAnext(Protocol[_T_co]):
# Comparison protocols

class SupportsDunderLT(Protocol):
def __lt__(self, __other: Any) -> Any: ...
def __lt__(self, __other: Any) -> bool: ...

class SupportsDunderGT(Protocol):
def __gt__(self, __other: Any) -> Any: ...
def __gt__(self, __other: Any) -> bool: ...

class SupportsDunderLE(Protocol):
def __le__(self, __other: Any) -> Any: ...
def __le__(self, __other: Any) -> bool: ...

class SupportsDunderGE(Protocol):
def __ge__(self, __other: Any) -> Any: ...
def __ge__(self, __other: Any) -> bool: ...

class SupportsAllComparisons(SupportsDunderLT, SupportsDunderGT, SupportsDunderLE, SupportsDunderGE, Protocol): ...

Expand Down Expand Up @@ -181,7 +181,7 @@ class SupportsNoArgReadline(Protocol[_T_co]):

# stable
class SupportsWrite(Protocol[_T_contra]):
def write(self, __s: _T_contra) -> Any: ...
def write(self, __s: _T_contra) -> object: ...

ReadOnlyBuffer = bytes # stable
# Anything that implements the read-write buffer interface.
Expand Down
0