Skip to content

Commit 819952c

Browse files
mypy fixes
1 parent 4dfb4b7 commit 819952c

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

pandas/core/frame.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8569,12 +8569,13 @@ class _IterableExceptStringOrBytes(metaclass=_IterableExceptStringOrBytesMeta):
85698569
pass
85708570

85718571

8572-
@create_block_manager.register
8573-
def _create_block_manager_iterable(
8574-
data: _IterableExceptStringOrBytes, df, index, columns, dtype, copy
8575-
):
8572+
@create_block_manager.register(_IterableExceptStringOrBytes)
8573+
def _create_block_manager_iterable(data: abc.Iterable, df, index, columns, dtype, copy):
85768574
if not isinstance(data, (abc.Sequence, ExtensionArray)):
85778575
data = list(data)
8576+
# Need this `else` to tell MyPy the proper type.
8577+
else:
8578+
data = cast(Union[abc.Sequence, ExtensionArray], data)
85788579
if len(data) > 0:
85798580
if is_dataclass(data[0]):
85808581
data = dataclasses_to_dicts(data)

0 commit comments

Comments
 (0)