Skip to content

Commit

Permalink
fix issue with py3.8
Browse files Browse the repository at this point in the history
  • Loading branch information
alexander-beedie committed Jan 26, 2024
1 parent c20e149 commit ef7da42
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 9 deletions.
1 change: 0 additions & 1 deletion py-polars/docs/source/reference/lazyframe/descriptive.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,5 @@ Descriptive
.. autosummary::
:toctree: api/

LazyFrame.describe
LazyFrame.explain
LazyFrame.show_graph
14 changes: 6 additions & 8 deletions py-polars/polars/io/spreadsheet/functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -527,18 +527,16 @@ def _initialise_spreadsheet_parser(
# note: can't read directly from bytes (yet) so
if read_bytesio := isinstance(source, BytesIO):
temp_data = NamedTemporaryFile(delete=True)
with nullcontext() if not read_bytesio else temp_data as xldata: # type: ignore[attr-defined]
with nullcontext() if not read_bytesio else temp_data as tmp: # type: ignore[attr-defined]
if read_bytesio:
xldata.write(source.getvalue()) # type: ignore[union-attr]
xldata = xldata.file.name
else:
xldata = source
tmp.write(source.getvalue()) # type: ignore[union-attr]
source = temp_data.name

if not Path(xldata).exists():
raise FileNotFoundError(xldata)
if not Path(source).exists(): # type: ignore[arg-type]
raise FileNotFoundError(source)

fxl = import_optional("fastexcel", min_version="0.7.0")
parser = fxl.read_excel(xldata, **engine_options)
parser = fxl.read_excel(source, **engine_options)
sheets = [
{"index": i + 1, "name": nm} for i, nm in enumerate(parser.sheet_names)
]
Expand Down

0 comments on commit ef7da42

Please sign in to comment.