mirror of
https://github.com/davidhalter/typeshed.git
synced 2026-01-03 01:53:24 +08:00
Fix various pos-only stubtest complaints previously allowlisted (#7228)
This commit is contained in:
@@ -304,15 +304,20 @@ class OrderedDict(dict[_KT, _VT], Reversible[_KT], Generic[_KT, _VT]):
|
||||
def keys(self) -> _OrderedDictKeysView[_KT, _VT]: ...
|
||||
def items(self) -> _OrderedDictItemsView[_KT, _VT]: ...
|
||||
def values(self) -> _OrderedDictValuesView[_KT, _VT]: ...
|
||||
# `fromkeys` is actually inherited from `dict` at runtime, so the signature should be kept in line with `dict.fromkeys`.
|
||||
# Ideally we would not redefine it here, but the true signature of `dict.fromkeys` is not expressible in the current type system.
|
||||
# The signature of OrderedDict.fromkeys should be kept in line with `dict.fromkeys`, modulo positional-only differences.
|
||||
# Like dict.fromkeys, its true signature is not expressible in the current type system.
|
||||
# See #3800 & https://github.com/python/typing/issues/548#issuecomment-683336963.
|
||||
@classmethod
|
||||
@overload
|
||||
def fromkeys(cls, __iterable: Iterable[_T], __value: None = ...) -> OrderedDict[_T, Any | None]: ...
|
||||
def fromkeys(cls, iterable: Iterable[_T], value: None = ...) -> OrderedDict[_T, Any | None]: ...
|
||||
@classmethod
|
||||
@overload
|
||||
def fromkeys(cls, __iterable: Iterable[_T], __value: _S) -> OrderedDict[_T, _S]: ...
|
||||
def fromkeys(cls, iterable: Iterable[_T], value: _S) -> OrderedDict[_T, _S]: ...
|
||||
# Keep OrderedDict.setdefault in line with MutableMapping.setdefault, modulo positional-only differences.
|
||||
@overload
|
||||
def setdefault(self: OrderedDict[_KT, _T | None], key: _KT) -> _T | None: ...
|
||||
@overload
|
||||
def setdefault(self, key: _KT, default: _VT) -> _VT: ...
|
||||
|
||||
class defaultdict(dict[_KT, _VT], Generic[_KT, _VT]):
|
||||
default_factory: Callable[[], _VT] | None
|
||||
|
||||
Reference in New Issue
Block a user