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

Function _read

pandas/io/html.py:117–143  ·  view source on GitHub ↗

Try to read from a url, file or string. Parameters ---------- obj : str, unicode, path object, or file-like object Returns ------- raw_text : str

(
    obj: FilePath | BaseBuffer,
    encoding: str | None,
    storage_options: StorageOptions | None,
)

Source from the content-addressed store, hash-verified

115
116
117def _read(
118 obj: FilePath | BaseBuffer,
119 encoding: str | None,
120 storage_options: StorageOptions | None,
121) -> str | bytes:
122 """
123 Try to read from a url, file or string.
124
125 Parameters
126 ----------
127 obj : str, unicode, path object, or file-like object
128
129 Returns
130 -------
131 raw_text : str
132 """
133 try:
134 with get_handle(
135 obj, "r", encoding=encoding, storage_options=storage_options
136 ) as handles:
137 return handles.handle.read()
138 except OSError as err:
139 if not is_url(obj):
140 raise FileNotFoundError(
141 f"[Errno {errno.ENOENT}] {os.strerror(errno.ENOENT)}: {obj}"
142 ) from err
143 raise
144
145
146class _HtmlFrameParser:

Callers 1

_setup_build_docMethod · 0.70

Calls 3

get_handleFunction · 0.90
is_urlFunction · 0.90
readMethod · 0.45

Tested by

no test coverage detected