Skip to content

Commit d6c5687

Browse files
author
Thomas Zilio
committed
fix: Fixing compatibility with merged changes.
1 parent 0a392e7 commit d6c5687

File tree

5 files changed

+19
-17
lines changed

5 files changed

+19
-17
lines changed

zcollection/collection/__init__.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -635,12 +635,12 @@ def update(
635635
storage.execute_transaction(
636636
client, self.synchronizer,
637637
client.map(local_func,
638-
tuple(batches),
639-
key=func.__name__,
640-
func_args=args,
641-
func_kwargs=kwargs))
638+
tuple(batches),
639+
key=func.__name__,
640+
func_args=args,
641+
func_kwargs=kwargs))
642642
else:
643-
local_func(selected_partitions)
643+
local_func(selected_partitions, args, kwargs)
644644
tuple(map(self.fs.invalidate_cache, selected_partitions))
645645

646646
def drop_variable(

zcollection/collection/callable_objects.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@
1616

1717
#: Function type to load and call a callback function of type
1818
#: :class:`PartitionCallable`.
19-
WrappedPartitionCallable = Callable[[Sequence[str], list[Any], dict[str, Any]],
20-
None]
19+
WrappedPartitionCallable = Callable[
20+
[Sequence[str], tuple[Any, ...], dict[str, Any]], None]
2121

2222

2323
#: pylint: disable=too-few-public-methods

zcollection/collection/detail.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@ def _wrap_update_func(
276276
array.
277277
"""
278278

279-
def wrap_function(partitions: Iterable[str], func_args: list[Any],
279+
def wrap_function(partitions: Iterable[str], func_args: tuple[Any, ...],
280280
func_kwargs: dict[str, Any]) -> None:
281281
# Applying function for each partition's data
282282
for partition in partitions:
@@ -328,7 +328,7 @@ def _wrap_update_func_with_overlap(
328328
if depth < 0:
329329
raise ValueError('Depth must be non-negative.')
330330

331-
def wrap_function(partitions: Sequence[str], func_args: list[Any],
331+
def wrap_function(partitions: Sequence[str], func_args: tuple[Any, ...],
332332
func_kwargs: dict[str, Any]) -> None:
333333
# Applying function for each partition's data
334334
for partition in partitions:

zcollection/view/__init__.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -610,15 +610,17 @@ def update(
610610
batches: Iterator[Sequence[Any]] = dask_utils.split_sequence(
611611
datasets_list, npartitions
612612
or dask_utils.dask_workers(client, cores_only=True))
613+
613614
awaitables: list[dask.distributed.Future] = client.map(
614615
wrap_function,
615616
tuple(batches),
616617
key=func.__name__,
617618
base_dir=self.base_dir,
618-
func_args=args,
619-
func_kwargs=kwargs)storage.execute_transaction(client, self.synchronizer, awaitables)
619+
func_args=args,
620+
func_kwargs=kwargs)
621+
storage.execute_transaction(client, self.synchronizer, awaitables)
620622
else:
621-
wrap_function(datasets_list, self.base_dir)
623+
wrap_function(datasets_list, self.base_dir, args, kwargs)
622624

623625
# pylint: disable=duplicate-code
624626
# false positive, no code duplication

zcollection/view/detail.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,9 @@
3838
from ..type_hints import ArrayLike, NDArray
3939

4040
#: Type of the function used to update a view.
41-
ViewUpdateCallable = Callable[
42-
[Iterable[tuple[dataset.Dataset, str]], str, list[Any], dict[str,
43-
Any]], None]
41+
ViewUpdateCallable = Callable[[
42+
Iterable[tuple[dataset.Dataset, str]], str, tuple[Any, ...], dict[str, Any]
43+
], None]
4444

4545
#: Name of the file that contains the checksum of the view.
4646
CHECKSUM_FILE = '.checksum'
@@ -383,7 +383,7 @@ def _wrap_update_func(
383383
"""
384384

385385
def wrap_function(parameters: Iterable[tuple[dataset.Dataset, str]],
386-
base_dir: str, func_args: list[Any],
386+
base_dir: str, func_args: tuple[Any, ...],
387387
func_kwargs: dict[str, Any]) -> None:
388388
"""Wrap the function to be applied to the dataset."""
389389
for zds, partition in parameters:
@@ -428,7 +428,7 @@ def _wrap_update_func_overlap(
428428
raise ValueError('The depth must be positive')
429429

430430
def wrap_function(parameters: Iterable[tuple[dataset.Dataset, str]],
431-
base_dir: str, func_args: list[Any],
431+
base_dir: str, func_args: tuple[Any, ...],
432432
func_kwargs: dict[str, Any]) -> None:
433433
"""Wrap the function to be applied to the dataset."""
434434
zds: dataset.Dataset

0 commit comments

Comments
 (0)