Add more missing methods to os._Environ (#6926)

This commit is contained in:
Alex Waygood
2022-01-16 14:45:11 +00:00
committed by GitHub
parent af8e37d273
commit dbcb38a605

View File

@@ -46,6 +46,8 @@ if sys.version_info >= (3, 9):
path = _path
_T = TypeVar("_T")
_T1 = TypeVar("_T1")
_T2 = TypeVar("_T2")
_AnyStr_co = TypeVar("_AnyStr_co", str, bytes, covariant=True)
# ----- os variables -----
@@ -246,9 +248,12 @@ class _Environ(MutableMapping[AnyStr, AnyStr], Generic[AnyStr]):
def __iter__(self) -> Iterator[AnyStr]: ...
def __len__(self) -> int: ...
if sys.version_info >= (3, 9):
def __or__(self, value: Mapping[_T1, _T2]) -> dict[AnyStr | _T1, AnyStr | _T2]: ...
def __ror__(self, value: Mapping[_T1, _T2]) -> dict[AnyStr | _T1, AnyStr | _T2]: ...
# We use @overload instead of a Union for reasons similar to those given for
# overloading MutableMapping.update in stdlib/typing.pyi
@overload
# The type: ignore is needed due to incompatible __or__/__ior__ signatures
@overload # type: ignore[misc]
def __ior__(self: Self, value: Mapping[AnyStr, AnyStr]) -> Self: ...
@overload
def __ior__(self: Self, value: Iterable[tuple[AnyStr, AnyStr]]) -> Self: ...