Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Dec 4, 2024
1 parent 8780dae commit 6f96f4f
Show file tree
Hide file tree
Showing 17 changed files with 340 additions and 135 deletions.
113 changes: 86 additions & 27 deletions src/dask_awkward/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,39 +11,98 @@
import dask_awkward.lib.utils as utils
from dask_awkward.lib.core import Array, PartitionCompatibility, Record, Scalar
from dask_awkward.lib.core import _type as type
from dask_awkward.lib.core import (compatible_partitions, dask_method,
dask_property, map_partitions,
partition_compatibility)
from dask_awkward.lib.core import (
compatible_partitions,
dask_method,
dask_property,
map_partitions,
partition_compatibility,
)
from dask_awkward.lib.describe import backend, fields
from dask_awkward.lib.inspect import (report_necessary_buffers,
report_necessary_columns, sample)
from dask_awkward.lib.inspect import (
report_necessary_buffers,
report_necessary_columns,
sample,
)

necessary_columns = report_necessary_columns # Export for backwards compatibility.

from dask_awkward.lib.io.io import (from_awkward, from_dask_array,
from_delayed, from_lists, from_map,
to_dask_array, to_dask_bag, to_dataframe,
to_delayed)
from dask_awkward.lib.io.io import (
from_awkward,
from_dask_array,
from_delayed,
from_lists,
from_map,
to_dask_array,
to_dask_bag,
to_dataframe,
to_delayed,
)
from dask_awkward.lib.io.json import from_json, layout_to_jsonschema, to_json
from dask_awkward.lib.io.parquet import from_parquet, to_parquet
from dask_awkward.lib.io.text import from_text
from dask_awkward.lib.operations import concatenate
from dask_awkward.lib.reducers import (all, any, argmax, argmin, corr, count,
count_nonzero, covar, linear_fit, max,
mean, min, moment, prod, ptp, softmax,
std, sum, var)
from dask_awkward.lib.structure import (argcartesian, argcombinations, argsort,
broadcast_arrays, cartesian,
combinations, copy, drop_none,
fill_none, firsts, flatten,
from_regular, full_like, is_none,
isclose, local_index, mask, nan_to_num,
num, ones_like, pad_none, ravel,
run_lengths, singletons, sort,
strings_astype, to_list, to_packed,
to_regular, unflatten, unzip,
values_astype, where, with_field,
with_name, with_parameter,
without_field, without_parameters,
zeros_like, zip)
from dask_awkward.lib.reducers import (
all,
any,
argmax,
argmin,
corr,
count,
count_nonzero,
covar,
linear_fit,
max,
mean,
min,
moment,
prod,
ptp,
softmax,
std,
sum,
var,
)
from dask_awkward.lib.structure import (
argcartesian,
argcombinations,
argsort,
broadcast_arrays,
cartesian,
combinations,
copy,
drop_none,
fill_none,
firsts,
flatten,
from_regular,
full_like,
is_none,
isclose,
local_index,
mask,
nan_to_num,
num,
ones_like,
pad_none,
ravel,
run_lengths,
singletons,
sort,
strings_astype,
to_list,
to_packed,
to_regular,
unflatten,
unzip,
values_astype,
where,
with_field,
with_name,
with_parameter,
without_field,
without_parameters,
zeros_like,
zip,
)
from dask_awkward.version import __version__
18 changes: 10 additions & 8 deletions src/dask_awkward/layers/__init__.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
from dask_awkward.layers.layers import (AwkwardBlockwiseLayer,
AwkwardInputLayer,
AwkwardMaterializedLayer,
AwkwardTreeReductionLayer,
ImplementsIOFunction,
ImplementsProjection,
IOFunctionWithMocking,
io_func_implements_projection)
from dask_awkward.layers.layers import (
AwkwardBlockwiseLayer,
AwkwardInputLayer,
AwkwardMaterializedLayer,
AwkwardTreeReductionLayer,
ImplementsIOFunction,
ImplementsProjection,
IOFunctionWithMocking,
io_func_implements_projection,
)

__all__ = (
"AwkwardInputLayer",
Expand Down
110 changes: 84 additions & 26 deletions src/dask_awkward/lib/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,34 +2,92 @@
import dask_awkward.lib.utils as utils
from dask_awkward.lib.core import Array, PartitionCompatibility, Record, Scalar
from dask_awkward.lib.core import _type as type
from dask_awkward.lib.core import (compatible_partitions, map_partitions,
partition_compatibility)
from dask_awkward.lib.core import (
compatible_partitions,
map_partitions,
partition_compatibility,
)
from dask_awkward.lib.describe import backend, fields
from dask_awkward.lib.inspect import (report_necessary_buffers,
report_necessary_columns, sample)
from dask_awkward.lib.io.io import (from_awkward, from_dask_array,
from_delayed, from_lists, from_map,
to_dask_array, to_dask_bag, to_dataframe,
to_delayed)
from dask_awkward.lib.inspect import (
report_necessary_buffers,
report_necessary_columns,
sample,
)
from dask_awkward.lib.io.io import (
from_awkward,
from_dask_array,
from_delayed,
from_lists,
from_map,
to_dask_array,
to_dask_bag,
to_dataframe,
to_delayed,
)
from dask_awkward.lib.io.json import from_json, to_json
from dask_awkward.lib.io.parquet import from_parquet, to_parquet
from dask_awkward.lib.io.text import from_text
from dask_awkward.lib.operations import concatenate
from dask_awkward.lib.reducers import (all, any, argmax, argmin, corr, count,
count_nonzero, covar, linear_fit, max,
mean, min, moment, prod, ptp, softmax,
std, sum, var)
from dask_awkward.lib.structure import (argcartesian, argcombinations, argsort,
broadcast_arrays, cartesian,
combinations, copy, drop_none,
fill_none, firsts, flatten,
from_regular, full_like, is_none,
isclose, local_index, mask, nan_to_num,
num, ones_like, pad_none, ravel,
run_lengths, singletons, sort,
strings_astype, to_list, to_packed,
to_regular, unflatten, unzip,
values_astype, where, with_field,
with_name, with_parameter,
without_field, without_parameters,
zeros_like, zip)
from dask_awkward.lib.reducers import (
all,
any,
argmax,
argmin,
corr,
count,
count_nonzero,
covar,
linear_fit,
max,
mean,
min,
moment,
prod,
ptp,
softmax,
std,
sum,
var,
)
from dask_awkward.lib.structure import (
argcartesian,
argcombinations,
argsort,
broadcast_arrays,
cartesian,
combinations,
copy,
drop_none,
fill_none,
firsts,
flatten,
from_regular,
full_like,
is_none,
isclose,
local_index,
mask,
nan_to_num,
num,
ones_like,
pad_none,
ravel,
run_lengths,
singletons,
sort,
strings_astype,
to_list,
to_packed,
to_regular,
unflatten,
unzip,
values_astype,
where,
with_field,
with_name,
with_parameter,
without_field,
without_parameters,
zeros_like,
zip,
)
37 changes: 27 additions & 10 deletions src/dask_awkward/lib/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,20 @@
import numpy as np
from awkward._do import remove_structure as ak_do_remove_structure
from awkward.highlevel import NDArrayOperatorsMixin, _dir_pattern
from awkward.typetracer import (MaybeNone, OneOf, TypeTracerArray,
create_unknown_scalar, is_unknown_scalar)
from dask.base import (DaskMethodsMixin, dont_optimize, is_dask_collection,
tokenize, unpack_collections)
from awkward.typetracer import (
MaybeNone,
OneOf,
TypeTracerArray,
create_unknown_scalar,
is_unknown_scalar,
)
from dask.base import (
DaskMethodsMixin,
dont_optimize,
is_dask_collection,
tokenize,
unpack_collections,
)
from dask.blockwise import BlockwiseDep
from dask.blockwise import blockwise as dask_blockwise
from dask.context import globalmethod
Expand All @@ -37,10 +47,15 @@

from dask_awkward.layers import AwkwardBlockwiseLayer, AwkwardMaterializedLayer
from dask_awkward.lib.optimize import all_optimizations
from dask_awkward.utils import (ConcretizationTypeError,
DaskAwkwardNotImplemented,
IncompatiblePartitions, field_access_to_front,
first, hyphenize, is_empty_slice)
from dask_awkward.utils import (
ConcretizationTypeError,
DaskAwkwardNotImplemented,
IncompatiblePartitions,
field_access_to_front,
first,
hyphenize,
is_empty_slice,
)

if TYPE_CHECKING:
from awkward.contents.content import Content
Expand Down Expand Up @@ -981,8 +996,10 @@ def repartition(
(npartitions=1) is a special case of this.
"""
from dask_awkward.layers import AwkwardMaterializedLayer
from dask_awkward.lib.structure import (repartition_layer,
simple_repartition_layer)
from dask_awkward.lib.structure import (
repartition_layer,
simple_repartition_layer,
)

if (
sum(
Expand Down
22 changes: 15 additions & 7 deletions src/dask_awkward/lib/io/columnar.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,21 @@
from awkward.forms import Form
from awkward.typetracer import typetracer_from_form, typetracer_with_report

from dask_awkward.layers.layers import (BackendT, ImplementsIOFunction,
ImplementsNecessaryColumns)
from dask_awkward.lib.utils import (METADATA_ATTRIBUTES, FormStructure,
buffer_keys_required_to_compute_shapes,
form_with_unique_keys, parse_buffer_key,
render_buffer_key, trace_form_structure,
walk_graph_depth_first)
from dask_awkward.layers.layers import (
BackendT,
ImplementsIOFunction,
ImplementsNecessaryColumns,
)
from dask_awkward.lib.utils import (
METADATA_ATTRIBUTES,
FormStructure,
buffer_keys_required_to_compute_shapes,
form_with_unique_keys,
parse_buffer_key,
render_buffer_key,
trace_form_structure,
walk_graph_depth_first,
)

if TYPE_CHECKING:
from awkward._nplikes.typetracer import TypeTracerReport
Expand Down
28 changes: 18 additions & 10 deletions src/dask_awkward/lib/io/io.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,24 @@
from dask.utils import funcname, is_integer, parse_bytes
from fsspec.utils import infer_compression

from dask_awkward.layers.layers import (AwkwardBlockwiseLayer,
AwkwardInputLayer,
AwkwardMaterializedLayer,
AwkwardTreeReductionLayer,
ImplementsMocking, ImplementsReport,
IOFunctionWithMocking,
io_func_implements_mocking,
io_func_implements_report)
from dask_awkward.lib.core import (Array, empty_typetracer, map_partitions,
new_array_object, typetracer_array)
from dask_awkward.layers.layers import (
AwkwardBlockwiseLayer,
AwkwardInputLayer,
AwkwardMaterializedLayer,
AwkwardTreeReductionLayer,
ImplementsMocking,
ImplementsReport,
IOFunctionWithMocking,
io_func_implements_mocking,
io_func_implements_report,
)
from dask_awkward.lib.core import (
Array,
empty_typetracer,
map_partitions,
new_array_object,
typetracer_array,
)
from dask_awkward.lib.io.columnar import ColumnProjectionMixin
from dask_awkward.utils import first, second

Expand Down
Loading

0 comments on commit 6f96f4f

Please sign in to comment.