Closed
Description
Bug Report
from __future__ import annotations
from typing import (
Any,
Hashable,
Iterable,
Iterator,
Mapping,
TypeVar,
)
HashableT = TypeVar("HashableT", bound=Hashable)
class Series:
...
def concat(objs: Iterable[Series] | Mapping[HashableT, Series]) -> Series:
...
def concat_single(objs: Mapping[HashableT, Series]) -> Series:
...
def concat_iterator(objs: Iterator[Series] | Mapping[HashableT, Series]) -> Series:
...
def concat_any(objs: Iterable[Series] | Mapping[Any, Series]) -> Series:
...
s1 = Series()
s2 = Series()
concat({1: s1, None: s2}) # fails
concat_single({1: s1, None: s2}) # works
concat_iterator({1: s1, None: s2}) # works
concat_any({1: s1, None: s2}) # works
Expected Behavior
No error :)
Actual Behavior
test.py:38: error: Dict entry 0 has incompatible type "int": "Series"; expected "Series": "Series" [dict-item]
test.py:38: error: Dict entry 1 has incompatible type "None": "Series"; expected "Series": "Series" [dict-item]
Your Environment
- Mypy version used: 0.981
- Python version used: 3.10.4