11from typing import Any
22
3- from typing_extensions import deprecated
4-
53__all__ = [
64 "ArrayNotFoundError" ,
75 "BaseZarrError" ,
@@ -29,15 +27,22 @@ def __init__(self, *args: Any) -> None:
2927 super ().__init__ (self ._msg .format (* args ))
3028
3129
32- class GroupNotFoundError (BaseZarrError , FileNotFoundError ):
30+ class NodeNotFoundError (BaseZarrError , FileNotFoundError ):
3331 """
34- Raised when a group isn't found at a certain path.
32+ Raised when a node (array or group) is not found at a certain path.
3533 """
3634
37- _msg = "No group found in store {!r} at path {!r}"
35+ def __init__ (self , * args : Any ) -> None :
36+ if len (args ) == 1 :
37+ # Pre-formatted message
38+ super (BaseZarrError , self ).__init__ (args [0 ])
39+ else :
40+ # Store and path arguments - format them
41+ _msg = "No node found in store {!r} at path {!r}"
42+ super (BaseZarrError , self ).__init__ (_msg .format (* args ))
3843
3944
40- class ArrayNotFoundError (BaseZarrError , FileNotFoundError ):
45+ class ArrayNotFoundError (NodeNotFoundError ):
4146 """
4247 Raised when an array isn't found at a certain path.
4348 """
@@ -52,14 +57,19 @@ def __init__(self, *args: Any) -> None:
5257 super (BaseZarrError , self ).__init__ (_msg .format (* args ))
5358
5459
55- @deprecated ("Use NodeNotFoundError instead." , category = None )
56- class PathNotFoundError (BaseZarrError ):
57- # Backwards compatibility with v2. Superseded by NodeNotFoundError.
58- ...
59-
60+ class GroupNotFoundError (NodeNotFoundError ):
61+ """
62+ Raised when a group isn't found at a certain path.
63+ """
6064
61- class NodeNotFoundError (PathNotFoundError ):
62- """Raised when an array or group does not exist at a certain path."""
65+ def __init__ (self , * args : Any ) -> None :
66+ if len (args ) == 1 :
67+ # Pre-formatted message
68+ super (BaseZarrError , self ).__init__ (args [0 ])
69+ else :
70+ # Store and path arguments - format them
71+ _msg = "No group found in store {!r} at path {!r}"
72+ super (BaseZarrError , self ).__init__ (_msg .format (* args ))
6373
6474
6575class ContainsGroupError (BaseZarrError ):
0 commit comments