Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[pre-commit.ci] pre-commit autoupdate #191

Merged
merged 2 commits into from
Jul 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,12 @@ repos:
- id: isort

- repo: https://github.com/pre-commit/mirrors-prettier
rev: v3.0.0-alpha.6
rev: v3.0.0-alpha.9-for-vscode
hooks:
- id: prettier

- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.1.1
rev: v1.4.1
hooks:
- id: mypy
additional_dependencies: [
Expand Down
2 changes: 1 addition & 1 deletion xbatcher/generators.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ def _gen_empty_batch_selectors(self) -> BatchSelectorSet:
Create an empty batch selector set that can be populated by appending
patches to each batch.
"""
n_batches = np.product(list(self._n_batches_per_dim.values()))
n_batches = np.prod(list(self._n_batches_per_dim.values()))
return {k: [] for k in range(n_batches)}

def _gen_patch_numbers(self, ds: Union[xr.DataArray, xr.Dataset]):
Expand Down
14 changes: 7 additions & 7 deletions xbatcher/testing.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,9 @@ def _get_sample_length(
else:
batch_concat_dims = []
return int(
np.product(list(non_specified_ds_dims.values()))
* np.product(list(non_input_batch_dims.values()))
* np.product(batch_concat_dims)
np.prod(list(non_specified_ds_dims.values()))
* np.prod(list(non_input_batch_dims.values()))
* np.prod(batch_concat_dims)
)


Expand Down Expand Up @@ -209,7 +209,7 @@ def _get_nbatches_from_input_dims(generator: BatchGenerator) -> int:
s : int
Number of batches expected given ``input_dims`` and ``input_overlap``.
"""
nbatches_from_input_dims = np.product(
nbatches_from_input_dims = np.prod(
[
generator.ds.sizes[dim] // length
for dim, length in generator.input_dims.items()
Expand All @@ -218,7 +218,7 @@ def _get_nbatches_from_input_dims(generator: BatchGenerator) -> int:
]
)
if generator.input_overlap:
nbatches_from_input_overlap = np.product(
nbatches_from_input_overlap = np.prod(
[
(generator.ds.sizes[dim] - overlap)
// (generator.input_dims[dim] - overlap)
Expand All @@ -242,13 +242,13 @@ def validate_generator_length(generator: BatchGenerator) -> None:
"""
non_input_batch_dims = _get_non_input_batch_dims(generator)
duplicate_batch_dims = _get_duplicate_batch_dims(generator)
nbatches_from_unique_batch_dims = np.product(
nbatches_from_unique_batch_dims = np.prod(
[
generator.ds.sizes[dim] // length
for dim, length in non_input_batch_dims.items()
]
)
nbatches_from_duplicate_batch_dims = np.product(
nbatches_from_duplicate_batch_dims = np.prod(
[
generator.ds.sizes[dim] // length
for dim, length in duplicate_batch_dims.items()
Expand Down