Skip to content

Improve accuracy of six byte index methods #9117

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 11 commits into from
Nov 10, 2022
Merged
Prev Previous commit
Next Next commit
Use Any as SupportsGetItem _VT_co
  • Loading branch information
Avasam committed Nov 7, 2022
commit 444b6166e75f8e65abd3736521a27c05fd745f59
2 changes: 1 addition & 1 deletion stdlib/_operator.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ class itemgetter(Generic[_T_co]):
def __new__(
cls, *items: _T_co
) -> itemgetter[tuple[_T_co, ...]]: ... # mypy lacks support for PEP 646 https://github.com/python/mypy/issues/12280
def __call__(self, obj: SupportsGetItem[_T_co, _T]) -> _T: ...
def __call__(self, __obj: SupportsGetItem[_T_co, Any]) -> Any: ...

@final
class methodcaller:
Expand Down
6 changes: 4 additions & 2 deletions stdlib/mmap.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,11 @@ class mmap(Iterable[int], Sized):
def __setitem__(self, __index: int, __object: int) -> None: ...
@overload
def __setitem__(self, __index: slice, __object: ReadableBuffer) -> None: ...
# Doesn't actually exist, but the object is actually iterable because it has __getitem__ and
# __len__, so we claim that there is also an __iter__ and __contains__ to help type checkers.
# Doesn't actually exist, but the object is actually iterable because it has __getitem__,
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
# Doesn't actually exist, but the object is actually iterable because it has __getitem__,
# Doesn't actually exist, but the object actually supports "in" because it has __getitem__,

# so we claim that there is also a __contains__ to help type checkers.
def __contains__(self, __o: object) -> bool: ...
# Doesn't actually exist, but the object is actually iterable because it has __getitem__ and __len__,
# so we claim that there is also an __iter__ to help type checkers.
def __iter__(self) -> Iterator[int]: ...
def __enter__(self: Self) -> Self: ...
def __exit__(self, *args: object) -> None: ...
Expand Down
2 changes: 1 addition & 1 deletion stubs/six/six/__init__.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ from re import Pattern
from typing import Any, AnyStr, NoReturn, TypeVar, overload
from typing_extensions import Literal

from . import moves as moves
from six import moves as moves

_T = TypeVar("_T")
_K = TypeVar("_K")
Expand Down
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy