MCPcopy
hub / github.com/pandas-dev/pandas / get_data_from_filepath

Function get_data_from_filepath

pandas/io/xml.py:677–702  ·  view source on GitHub ↗

Extract raw XML data. The method accepts two input types: 1. filepath (string-like) 2. file-like object (e.g. open file object, StringIO)

(
    filepath_or_buffer: FilePath | ReadBuffer[bytes] | ReadBuffer[str],
    encoding: str | None,
    compression: CompressionOptions,
    storage_options: StorageOptions,
)

Source from the content-addressed store, hash-verified

675
676
677def get_data_from_filepath(
678 filepath_or_buffer: FilePath | ReadBuffer[bytes] | ReadBuffer[str],
679 encoding: str | None,
680 compression: CompressionOptions,
681 storage_options: StorageOptions,
682):
683 """
684 Extract raw XML data.
685
686 The method accepts two input types:
687 1. filepath (string-like)
688 2. file-like object (e.g. open file object, StringIO)
689 """
690 filepath_or_buffer = stringify_path(filepath_or_buffer)
691 with get_handle(
692 filepath_or_buffer,
693 "r",
694 encoding=encoding,
695 compression=compression,
696 storage_options=storage_options,
697 ) as handle_obj:
698 return (
699 preprocess_data(handle_obj.handle.read())
700 if hasattr(handle_obj.handle, "read")
701 else handle_obj.handle
702 )
703
704
705def preprocess_data(

Callers 3

_transform_docMethod · 0.90
_parse_docMethod · 0.85
_parse_docMethod · 0.85

Calls 4

stringify_pathFunction · 0.90
get_handleFunction · 0.90
preprocess_dataFunction · 0.85
readMethod · 0.45

Tested by

no test coverage detected