Skip to content

Commit

Permalink
Merge branch 'main' into implement_reduce
Browse files Browse the repository at this point in the history
  • Loading branch information
d-v-b committed Jul 19, 2022
2 parents dc7af2c + ece1810 commit 2c6c779
Show file tree
Hide file tree
Showing 13 changed files with 36 additions and 25 deletions.
3 changes: 0 additions & 3 deletions .deepsource.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,3 @@ test_patterns = ["zarr/tests/test_*.py"]
[[analyzers]]
name = "python"
enabled = true

[analyzers.meta]
runtime_version = "3.x.x"
20 changes: 17 additions & 3 deletions docs/release.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,24 @@ Release notes
# to document your changes. On releases it will be
# re-indented so that it does not show up in the notes.
.. _unreleased:
.. _unreleased:

Unreleased
----------
Unreleased
----------

Documentation
~~~~~~~~~~~~~

* Typo fixes to close quotes. By :user:`Pavithra Eswaramoorthy <pavithraes>`

Maintenance
~~~~~~~~~~~

* Fix a few DeepSource.io alerts
By :user:`Dimitri Papadopoulos Orfanos <DimitriPapadopoulos>` :issue:`1080`.

* Fix spelling.
By :user:`Dimitri Papadopoulos Orfanos <DimitriPapadopoulos>`, :issue:`1073`.

.. _release_2.12.0:

Expand Down
6 changes: 3 additions & 3 deletions docs/tutorial.rst
Original file line number Diff line number Diff line change
Expand Up @@ -897,7 +897,7 @@ The second invocation here will be much faster. Note that the ``storage_options`
have become more complex here, to account for the two parts of the supplied
URL.

It is also possible to initialize the filesytem outside of Zarr and then pass
It is also possible to initialize the filesystem outside of Zarr and then pass
it through. This requires creating an :class:`zarr.storage.FSStore` object
explicitly. For example::

Expand Down Expand Up @@ -1404,15 +1404,15 @@ access patterns and incur a substantial performance hit when using
file based stores. One of the most pathological examples is
switching from column-based chunking to row-based chunking e.g. ::

>>> a = zarr.zeros((10000,10000), chunks=(10000, 1), dtype='uint16, store='a.zarr')
>>> a = zarr.zeros((10000,10000), chunks=(10000, 1), dtype='uint16', store='a.zarr')
>>> b = zarr.array(a, chunks=(1,10000), store='b.zarr')

which will require every chunk in the input data set to be repeatedly read when creating
each output chunk. If the entire array will fit within memory, this is simply resolved
by forcing the entire input array into memory as a numpy array before converting
back to zarr with the desired chunking. ::

>>> a = zarr.zeros((10000,10000), chunks=(10000, 1), dtype='uint16, store='a.zarr')
>>> a = zarr.zeros((10000,10000), chunks=(10000, 1), dtype='uint16', store='a.zarr')
>>> b = a[...]
>>> c = zarr.array(b, chunks=(1,10000), store='c.zarr')

Expand Down
2 changes: 1 addition & 1 deletion requirements_dev_minimal.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ asciitree==0.3.3
fasteners==0.17.3
numcodecs==0.10.0
msgpack-python==0.5.6
setuptools-scm==7.0.4
setuptools-scm==7.0.5
# test requirements
pytest==7.1.2
2 changes: 1 addition & 1 deletion zarr/convenience.py
Original file line number Diff line number Diff line change
Expand Up @@ -1279,7 +1279,7 @@ def open_consolidated(store: StoreLike, metadata_key=".zmetadata", mode="r+", **
"""

# normalize parameters
zarr_version = kwargs.get('zarr_version', None)
zarr_version = kwargs.get('zarr_version')
store = normalize_store_arg(store, storage_options=kwargs.get("storage_options"), mode=mode,
zarr_version=zarr_version)
if mode not in {'r', 'r+'}:
Expand Down
2 changes: 1 addition & 1 deletion zarr/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ class Array:

def __init__(
self,
store: Any, # BaseStore not stricly required due to normalize_store_arg
store: Any, # BaseStore not strictly required due to normalize_store_arg
path=None,
read_only=False,
chunk_store=None,
Expand Down
2 changes: 1 addition & 1 deletion zarr/hierarchy.py
Original file line number Diff line number Diff line change
Expand Up @@ -1330,7 +1330,7 @@ def open_group(store=None, mode='a', cache_attrs=True, synchronizer=None, path=N
storage_options=storage_options,
mode=mode,
zarr_version=zarr_version)
if not getattr(chunk_store, '_store_version', DEFAULT_ZARR_VERSION) == zarr_version:
if getattr(chunk_store, '_store_version', DEFAULT_ZARR_VERSION) != zarr_version:
raise ValueError(
"zarr_version of store and chunk_store must match"
)
Expand Down
4 changes: 2 additions & 2 deletions zarr/meta.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ def get_extended_dtype_info(dtype) -> dict:
fallback=None,
)
else:
raise ValueError(f"Unsupport dtype: {dtype}")
raise ValueError(f"Unsupported dtype: {dtype}")


class Metadata2:
Expand Down Expand Up @@ -399,7 +399,7 @@ def decode_hierarchy_metadata(
"metadata_key_suffix",
"extensions",
}:
raise ValueError(f"Unexpected keys in metdata. meta={meta}")
raise ValueError(f"Unexpected keys in metadata. meta={meta}")
return meta

@classmethod
Expand Down
2 changes: 1 addition & 1 deletion zarr/storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -1413,7 +1413,7 @@ def __contains__(self, key):
return key in self.map

def __eq__(self, other):
return (type(self) == type(other) and self.map == other.map
return (type(self) is type(other) and self.map == other.map
and self.mode == other.mode)

def keys(self):
Expand Down
2 changes: 1 addition & 1 deletion zarr/tests/test_convenience.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
)
from zarr.tests.util import have_fsspec

_VERSIONS = v3_api_available and (2, 3) or (2,)
_VERSIONS = ((2, 3) if v3_api_available else (2, ))


def _init_creation_kwargs(zarr_version):
Expand Down
12 changes: 6 additions & 6 deletions zarr/tests/test_creation.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
from zarr._storage.v3 import DirectoryStoreV3, KVStoreV3
from zarr.sync import ThreadSynchronizer

_VERSIONS = v3_api_available and (None, 2, 3) or (None, 2)
_VERSIONS2 = v3_api_available and (2, 3) or (2,)
_VERSIONS = ((None, 2, 3) if v3_api_available else (None, 2))
_VERSIONS2 = ((2, 3) if v3_api_available else (2, ))


# something bcolz-like
Expand Down Expand Up @@ -430,7 +430,7 @@ def test_empty_like(zarr_version):
z = empty(100, chunks=10, dtype='f4', compressor=Zlib(5),
order='F', **kwargs)
# zarr_version will be inferred from z, but have to specify a path in v3
z2 = empty_like(z, path=kwargs.get('path', None))
z2 = empty_like(z, path=kwargs.get('path'))
assert z.shape == z2.shape
assert z.chunks == z2.chunks
assert z.dtype == z2.dtype
Expand Down Expand Up @@ -479,7 +479,7 @@ def test_zeros_like(zarr_version):
# zarr array
z = zeros(100, chunks=10, dtype='f4', compressor=Zlib(5),
order='F', **kwargs)
z2 = zeros_like(z, path=kwargs.get('path', None))
z2 = zeros_like(z, path=kwargs.get('path'))
assert z.shape == z2.shape
assert z.chunks == z2.chunks
assert z.dtype == z2.dtype
Expand All @@ -506,7 +506,7 @@ def test_ones_like(zarr_version):
# zarr array
z = ones(100, chunks=10, dtype='f4', compressor=Zlib(5),
order='F', **kwargs)
z2 = ones_like(z, path=kwargs.get('path', None))
z2 = ones_like(z, path=kwargs.get('path'))
assert z.shape == z2.shape
assert z.chunks == z2.chunks
assert z.dtype == z2.dtype
Expand All @@ -533,7 +533,7 @@ def test_full_like(zarr_version):

z = full(100, chunks=10, dtype='f4', compressor=Zlib(5),
fill_value=42, order='F', **kwargs)
z2 = full_like(z, path=kwargs.get('path', None))
z2 = full_like(z, path=kwargs.get('path'))
assert z.shape == z2.shape
assert z.chunks == z2.chunks
assert z.dtype == z2.dtype
Expand Down
2 changes: 1 addition & 1 deletion zarr/tests/test_hierarchy.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
from zarr.tests.util import skip_test_env_var, have_fsspec, abs_container


_VERSIONS = v3_api_available and (2, 3) or (2,)
_VERSIONS = ((2, 3) if v3_api_available else (2, ))

# noinspection PyStatementEffect

Expand Down
2 changes: 1 addition & 1 deletion zarr/tests/test_storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -2400,7 +2400,7 @@ def test_iterators_with_prefix(self):
assert 4 == len(store)
keys = [prefix + 'a', prefix + 'b', prefix + 'c/d', prefix + 'c/e/f']
values = [b'aaa', b'bbb', b'ddd', b'fff']
items = [(k, v) for k, v in zip(keys, values)]
items = list(zip(keys, values))
assert set(keys) == set(store)
assert set(keys) == set(store.keys())
assert set(values) == set(store.values())
Expand Down

0 comments on commit 2c6c779

Please sign in to comment.