Skip to content

Commit d0f43ee

Browse files
TYP: improve type annotations in pandas.io.xml (#62312)
1 parent 9c4b72f commit d0f43ee

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

pandas/io/xml.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -666,7 +666,7 @@ def _transform_doc(self) -> etree._XSLTResultTree:
666666

667667

668668
def get_data_from_filepath(
669-
filepath_or_buffer: FilePath | bytes | ReadBuffer[bytes] | ReadBuffer[str],
669+
filepath_or_buffer: FilePath | ReadBuffer[bytes] | ReadBuffer[str],
670670
encoding: str | None,
671671
compression: CompressionOptions,
672672
storage_options: StorageOptions,
@@ -678,9 +678,9 @@ def get_data_from_filepath(
678678
1. filepath (string-like)
679679
2. file-like object (e.g. open file object, StringIO)
680680
"""
681-
filepath_or_buffer = stringify_path(filepath_or_buffer) # type: ignore[arg-type]
682-
with get_handle( # pyright: ignore[reportCallIssue]
683-
filepath_or_buffer, # pyright: ignore[reportArgumentType]
681+
filepath_or_buffer = stringify_path(filepath_or_buffer)
682+
with get_handle(
683+
filepath_or_buffer,
684684
"r",
685685
encoding=encoding,
686686
compression=compression,
@@ -693,7 +693,9 @@ def get_data_from_filepath(
693693
)
694694

695695

696-
def preprocess_data(data) -> io.StringIO | io.BytesIO:
696+
def preprocess_data(
697+
data: str | bytes | io.StringIO | io.BytesIO,
698+
) -> io.StringIO | io.BytesIO:
697699
"""
698700
Convert extracted raw data.
699701
@@ -711,7 +713,7 @@ def preprocess_data(data) -> io.StringIO | io.BytesIO:
711713
return data
712714

713715

714-
def _data_to_frame(data, **kwargs) -> DataFrame:
716+
def _data_to_frame(data: list[dict[str, str | None]], **kwargs) -> DataFrame:
715717
"""
716718
Convert parsed data to Data Frame.
717719

0 commit comments

Comments
 (0)