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
byte2int as method
  • Loading branch information
Avasam committed Nov 7, 2022
commit 6c9f88cc72595a70f6fb78ba7282b664ffc9f3d7
8 changes: 4 additions & 4 deletions stdlib/_operator.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -115,11 +115,11 @@ class itemgetter(Generic[_T_co]):
def __new__(
cls, item: _T_co, __item2: _T_co, __item3: _T_co, __item4: _T_co
) -> itemgetter[tuple[_T_co, _T_co, _T_co, _T_co]]: ...
# mypy lacks support for PEP 646 https://github.com/python/mypy/issues/12280
@overload
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, Any]) -> Any: ...
def __new__(cls, *items: _T_co) -> itemgetter[tuple[_T_co, ...]]: ...
# A bug in mypy prevents using _T instead of Any here.
def __call__(self, obj: SupportsGetItem[_T_co, Any]) -> Any: ...

@final
class methodcaller:
Expand Down
6 changes: 4 additions & 2 deletions stubs/six/six/__init__.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import builtins
import operator
import types
import unittest
from _typeshed import IdentityFunction
from _typeshed import IdentityFunction, SupportsGetItem
from builtins import next as next
from collections.abc import Callable, ItemsView, Iterable, Iterator as _Iterator, KeysView, Mapping, ValuesView
from functools import wraps as wraps
Expand Down Expand Up @@ -65,7 +65,9 @@ unichr = chr

def int2byte(i: int) -> bytes: ...

byte2int: operator.itemgetter[int]
# Should be `byte2int: operator.itemgetter[int]`. But a bug in mypy prevents using TypeVar in itemgetter__call__
def byte2int(obj: SupportsGetItem[int, _T]) -> _T: ...

indexbytes = operator.getitem
iterbytes = iter

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