Skip to content

Commit

Permalink
typing and pre-commit fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
dougbrn committed May 14, 2024
1 parent 4b98df8 commit 9cdba35
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
11 changes: 6 additions & 5 deletions src/dask_nested/backends.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,21 @@


@make_meta_dispatch.register(npd.NestedFrame)
def make_meta_frame(x, index=None):
# Create an empty NestedFrame to use as Dask's underlying object meta.
def make_meta_frame(x, index=None) -> npd.NestedFrame:
"""Create an empty NestedFrame to use as Dask's underlying object meta."""
result = x.head(0)
return result


@meta_nonempty.register(npd.NestedFrame)
def _nonempty_nestedframe(x, index=None):
# Construct a new NestedFrame with the same underlying data.
def _nonempty_nestedframe(x, index=None) -> npd.NestedFrame:
"""Construct a new NestedFrame with the same underlying data."""
df = meta_nonempty_dataframe(x)
return npd.NestedFrame(df)


@make_array_nonempty.register(npd.NestedDtype)
def _(dtype):
def _(dtype) -> NestedExtensionArray:
"""Register a valid dtype for the NestedExtensionArray"""
# must be two values
return NestedExtensionArray._from_sequence([pd.NA, pd.NA], dtype=dtype)
3 changes: 2 additions & 1 deletion src/dask_nested/io.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def read_parquet(
parquet_file_extension=(".parq", ".parquet", ".pq"),
filesystem=None,
**kwargs,
):
) -> NestedFrame:
"""
Read a Parquet file into a Dask DataFrame
Expand Down Expand Up @@ -181,6 +181,7 @@ def read_parquet(
It may be necessary to change this argument if the data files in your
parquet dataset do not end in ".parq", ".parquet", or ".pq".
filesystem: "fsspec", "arrow", or fsspec.AbstractFileSystem backend to use.
Specifies the backend to use
dataset: dict, default None
Dictionary of options to use when creating a ``pyarrow.dataset.Dataset`` object.
These options may include a "filesystem" key to configure the desired
Expand Down

0 comments on commit 9cdba35

Please sign in to comment.