Skip to content

Commit 8aa8e9e

Browse files
committed
array name is not nullable
1 parent 26b6d8d commit 8aa8e9e

File tree

1 file changed

+9
-14
lines changed

1 file changed

+9
-14
lines changed

src/zarr/core/array.py

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -810,34 +810,30 @@ def path(self) -> str:
810810
return self.store_path.path
811811

812812
@property
813-
def name(self) -> str | None:
813+
def name(self) -> str:
814814
"""Array name following h5py convention.
815815
816816
Returns
817817
-------
818818
str
819819
The name of the array.
820820
"""
821-
if self.path:
822-
# follow h5py convention: add leading slash
823-
name = self.path
824-
if name[0] != "/":
825-
name = "/" + name
826-
return name
827-
return None
821+
# follow h5py convention: add leading slash
822+
name = self.path
823+
if not name.startswith("/"):
824+
name = "/" + name
825+
return name
828826

829827
@property
830-
def basename(self) -> str | None:
828+
def basename(self) -> str:
831829
"""Final component of name.
832830
833831
Returns
834832
-------
835833
str
836834
The basename or final component of the array name.
837835
"""
838-
if self.name is not None:
839-
return self.name.split("/")[-1]
840-
return None
836+
return self.name.split("/")[-1]
841837

842838
@property
843839
def cdata_shape(self) -> ChunkCoords:
@@ -1626,8 +1622,7 @@ def path(self) -> str:
16261622
return self._async_array.path
16271623

16281624
@property
1629-
def name(self) -> str | None:
1630-
"""Array name following h5py convention."""
1625+
def name(self) -> str:
16311626
return self._async_array.name
16321627

16331628
@property

0 commit comments

Comments
 (0)