@@ -33,29 +33,29 @@ class GroupInfo:
3333 or when using :class:`Group.info_complete`.
3434 """
3535
36- name : str
37- type : Literal ["Group" ] = "Group"
38- zarr_format : Literal [2 , 3 ]
39- read_only : bool
40- store_type : str
41- count_members : int | None = None
42- count_arrays : int | None = None
43- count_groups : int | None = None
36+ _name : str
37+ _type : Literal ["Group" ] = "Group"
38+ _zarr_format : Literal [2 , 3 ]
39+ _read_only : bool
40+ _store_type : str
41+ _count_members : int | None = None
42+ _count_arrays : int | None = None
43+ _count_groups : int | None = None
4444
4545 def __repr__ (self ) -> str :
4646 template = textwrap .dedent ("""\
47- Name : {name }
48- Type : {type }
49- Zarr format : {zarr_format }
50- Read-only : {read_only }
51- Store type : {store_type }""" )
52-
53- if self .count_members is not None :
54- template += "\n No. members : {count_members }"
55- if self .count_arrays is not None :
56- template += "\n No. arrays : {count_arrays }"
57- if self .count_groups is not None :
58- template += "\n No. groups : {count_groups }"
47+ Name : {_name }
48+ Type : {_type }
49+ Zarr format : {_zarr_format }
50+ Read-only : {_read_only }
51+ Store type : {_store_type }""" )
52+
53+ if self ._count_members is not None :
54+ template += "\n No. members : {_count_members }"
55+ if self ._count_arrays is not None :
56+ template += "\n No. arrays : {_count_arrays }"
57+ if self ._count_groups is not None :
58+ template += "\n No. groups : {_count_groups }"
5959 return template .format (** dataclasses .asdict (self ))
6060
6161
@@ -83,61 +83,68 @@ def byte_info(size: int) -> str:
8383
8484@dataclasses .dataclass (kw_only = True )
8585class ArrayInfo :
86- type : Literal ["Array" ] = "Array"
87- zarr_format : Literal [2 , 3 ]
88- data_type : str
89- shape : tuple [int , ...]
90- chunk_shape : tuple [int , ...] | None = None
91- order : Literal ["C" , "F" ]
92- read_only : bool
93- store_type : str
94- compressor : str | None = None
95- filters : list [str ] | None = None
96- codecs : str | None = None
97- count_bytes : int | None = None
98- count_bytes_stored : int | None = None
99- count_chunks_initialized : int | None = None
86+ """
87+ Render the information for an array.
88+
89+ Note that this method and its properties is not part of
90+ Zarr's public API.
91+ """
92+
93+ _type : Literal ["Array" ] = "Array"
94+ _zarr_format : Literal [2 , 3 ]
95+ _data_type : str
96+ _shape : tuple [int , ...]
97+ _chunk_shape : tuple [int , ...] | None = None
98+ _order : Literal ["C" , "F" ]
99+ _read_only : bool
100+ _store_type : str
101+ _compressor : str | None = None
102+ _filters : list [str ] | None = None
103+ _codecs : str | None = None
104+ _count_bytes : int | None = None
105+ _count_bytes_stored : int | None = None
106+ _count_chunks_initialized : int | None = None
100107
101108 def __repr__ (self ) -> str :
102109 template = textwrap .dedent ("""\
103- Type : {type }
104- Zarr format : {zarr_format }
105- Data type : {data_type }
106- Shape : {shape }
107- Chunk shape : {chunk_shape }
108- Order : {order }
109- Read-only : {read_only }
110- Store type : {store_type }""" )
110+ Type : {_type }
111+ Zarr format : {_zarr_format }
112+ Data type : {_data_type }
113+ Shape : {_shape }
114+ Chunk shape : {_chunk_shape }
115+ Order : {_order }
116+ Read-only : {_read_only }
117+ Store type : {_store_type }""" )
111118
112119 kwargs = dataclasses .asdict (self )
113- if self .chunk_shape is None :
120+ if self ._chunk_shape is None :
114121 # for non-regular chunk grids
115122 kwargs ["chunk_shape" ] = "<variable>"
116- if self .compressor is not None :
117- template += "\n Compressor : {compressor }"
123+ if self ._compressor is not None :
124+ template += "\n Compressor : {_compressor }"
118125
119- if self .filters is not None :
120- template += "\n Filters : {filters }"
126+ if self ._filters is not None :
127+ template += "\n Filters : {_filters }"
121128
122- if self .codecs is not None :
123- template += "\n Codecs : {codecs }"
129+ if self ._codecs is not None :
130+ template += "\n Codecs : {_codecs }"
124131
125- if self .count_bytes is not None :
126- template += "\n No. bytes : {count_bytes }"
127- kwargs ["count_bytes " ] = byte_info (self .count_bytes )
132+ if self ._count_bytes is not None :
133+ template += "\n No. bytes : {_count_bytes }"
134+ kwargs ["_count_bytes " ] = byte_info (self ._count_bytes )
128135
129- if self .count_bytes_stored is not None :
130- template += "\n No. bytes stored : {count_bytes_stored }"
131- kwargs ["count_stored " ] = byte_info (self .count_bytes_stored )
136+ if self ._count_bytes_stored is not None :
137+ template += "\n No. bytes stored : {_count_bytes_stored }"
138+ kwargs ["_count_stored " ] = byte_info (self ._count_bytes_stored )
132139
133140 if (
134- self .count_bytes is not None
135- and self .count_bytes_stored is not None
136- and self .count_bytes_stored > 0
141+ self ._count_bytes is not None
142+ and self ._count_bytes_stored is not None
143+ and self ._count_bytes_stored > 0
137144 ):
138- template += "\n Storage ratio : {storage_ratio }"
139- kwargs ["storage_ratio " ] = f"{ self .count_bytes / self .count_bytes_stored :.1f} "
145+ template += "\n Storage ratio : {_storage_ratio }"
146+ kwargs ["_storage_ratio " ] = f"{ self ._count_bytes / self ._count_bytes_stored :.1f} "
140147
141- if self .count_chunks_initialized is not None :
142- template += "\n Chunks Initialized : {count_chunks_initialized }"
148+ if self ._count_chunks_initialized is not None :
149+ template += "\n Chunks Initialized : {_count_chunks_initialized }"
143150 return template .format (** kwargs )
0 commit comments