figpack 0.2.15__py3-none-any.whl → 0.2.17__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- figpack/__init__.py +4 -3
- figpack/core/__init__.py +2 -2
- figpack/core/_bundle_utils.py +80 -33
- figpack/core/_view_figure.py +1 -1
- figpack/core/extension_view.py +9 -27
- figpack/core/figpack_extension.py +0 -71
- figpack/core/figpack_view.py +2 -2
- figpack/core/zarr.py +61 -0
- figpack/figpack-figure-dist/assets/index-DBwmtEpB.js +91 -0
- figpack/figpack-figure-dist/assets/{index-D9a3K6eW.css → index-DHWczh-Q.css} +1 -1
- figpack/figpack-figure-dist/index.html +2 -2
- figpack/views/Box.py +2 -3
- figpack/views/DataFrame.py +6 -12
- figpack/views/Gallery.py +2 -3
- figpack/views/Image.py +3 -9
- figpack/views/Markdown.py +3 -4
- figpack/views/MatplotlibFigure.py +2 -11
- figpack/views/MultiChannelTimeseries.py +2 -6
- figpack/views/PlotlyExtension/PlotlyExtension.py +8 -60
- figpack/views/PlotlyExtension/_plotly_extension.py +46 -0
- figpack/views/PlotlyExtension/plotly_view.js +84 -80
- figpack/views/Spectrogram.py +2 -7
- figpack/views/Splitter.py +2 -3
- figpack/views/TabLayout.py +2 -3
- figpack/views/TimeseriesGraph.py +6 -10
- figpack/views/__init__.py +1 -0
- {figpack-0.2.15.dist-info → figpack-0.2.17.dist-info}/METADATA +21 -2
- figpack-0.2.17.dist-info/RECORD +43 -0
- figpack/figpack-figure-dist/assets/index-DtOnN02w.js +0 -846
- figpack/franklab/__init__.py +0 -5
- figpack/franklab/views/TrackAnimation.py +0 -153
- figpack/franklab/views/__init__.py +0 -9
- figpack/spike_sorting/__init__.py +0 -5
- figpack/spike_sorting/views/AutocorrelogramItem.py +0 -32
- figpack/spike_sorting/views/Autocorrelograms.py +0 -118
- figpack/spike_sorting/views/AverageWaveforms.py +0 -147
- figpack/spike_sorting/views/CrossCorrelogramItem.py +0 -35
- figpack/spike_sorting/views/CrossCorrelograms.py +0 -132
- figpack/spike_sorting/views/RasterPlot.py +0 -288
- figpack/spike_sorting/views/RasterPlotItem.py +0 -28
- figpack/spike_sorting/views/SpikeAmplitudes.py +0 -374
- figpack/spike_sorting/views/SpikeAmplitudesItem.py +0 -38
- figpack/spike_sorting/views/UnitMetricsGraph.py +0 -129
- figpack/spike_sorting/views/UnitSimilarityScore.py +0 -40
- figpack/spike_sorting/views/UnitsTable.py +0 -89
- figpack/spike_sorting/views/UnitsTableColumn.py +0 -40
- figpack/spike_sorting/views/UnitsTableRow.py +0 -36
- figpack/spike_sorting/views/__init__.py +0 -41
- figpack-0.2.15.dist-info/RECORD +0 -60
- {figpack-0.2.15.dist-info → figpack-0.2.17.dist-info}/WHEEL +0 -0
- {figpack-0.2.15.dist-info → figpack-0.2.17.dist-info}/entry_points.txt +0 -0
- {figpack-0.2.15.dist-info → figpack-0.2.17.dist-info}/licenses/LICENSE +0 -0
- {figpack-0.2.15.dist-info → figpack-0.2.17.dist-info}/top_level.txt +0 -0
figpack/__init__.py
CHANGED
|
@@ -2,15 +2,16 @@
|
|
|
2
2
|
figpack - A Python package for creating shareable, interactive visualizations in the browser
|
|
3
3
|
"""
|
|
4
4
|
|
|
5
|
-
__version__ = "0.2.
|
|
5
|
+
__version__ = "0.2.17"
|
|
6
6
|
|
|
7
7
|
from .cli import view_figure
|
|
8
|
-
from .core import FigpackView, FigpackExtension,
|
|
8
|
+
from .core import FigpackView, FigpackExtension, ExtensionView
|
|
9
|
+
from .core.zarr import Group
|
|
9
10
|
|
|
10
11
|
__all__ = [
|
|
11
12
|
"view_figure",
|
|
12
13
|
"FigpackView",
|
|
13
14
|
"FigpackExtension",
|
|
14
|
-
"ExtensionRegistry",
|
|
15
15
|
"ExtensionView",
|
|
16
|
+
"Group",
|
|
16
17
|
]
|
figpack/core/__init__.py
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
from .figpack_view import FigpackView
|
|
2
|
-
from .figpack_extension import FigpackExtension
|
|
2
|
+
from .figpack_extension import FigpackExtension
|
|
3
3
|
from .extension_view import ExtensionView
|
|
4
4
|
|
|
5
|
-
__all__ = ["FigpackView", "FigpackExtension", "
|
|
5
|
+
__all__ = ["FigpackView", "FigpackExtension", "ExtensionView"]
|
figpack/core/_bundle_utils.py
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import os
|
|
2
2
|
import pathlib
|
|
3
|
+
import json
|
|
3
4
|
from typing import Set
|
|
4
5
|
|
|
5
6
|
import zarr
|
|
6
7
|
|
|
7
8
|
from .figpack_view import FigpackView
|
|
8
|
-
from .figpack_extension import
|
|
9
|
+
from .figpack_extension import FigpackExtension
|
|
9
10
|
from .extension_view import ExtensionView
|
|
11
|
+
from .zarr import Group, _check_zarr_version
|
|
10
12
|
|
|
11
13
|
thisdir = pathlib.Path(__file__).parent.resolve()
|
|
12
14
|
|
|
@@ -45,24 +47,35 @@ def prepare_figure_bundle(
|
|
|
45
47
|
target_sub = target / subitem.name
|
|
46
48
|
target_sub.write_bytes(subitem.read_bytes())
|
|
47
49
|
|
|
48
|
-
#
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
50
|
+
# If we are using zarr 3, then we set the default zarr format to 2 temporarily
|
|
51
|
+
# because we only support version 2 on the frontend right now.
|
|
52
|
+
|
|
53
|
+
if _check_zarr_version() == 3:
|
|
54
|
+
old_default_zarr_format = zarr.config.get("default_zarr_format")
|
|
55
|
+
zarr.config.set({"default_zarr_format": 2})
|
|
56
|
+
|
|
57
|
+
try:
|
|
58
|
+
# Write the view data to the Zarr group
|
|
59
|
+
zarr_group = zarr.open_group(pathlib.Path(tmpdir) / "data.zarr", mode="w")
|
|
60
|
+
zarr_group = Group(zarr_group)
|
|
61
|
+
view._write_to_zarr_group(zarr_group)
|
|
55
62
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
63
|
+
# Add title and description as attributes on the top-level zarr group
|
|
64
|
+
zarr_group.attrs["title"] = title
|
|
65
|
+
if description is not None:
|
|
66
|
+
zarr_group.attrs["description"] = description
|
|
60
67
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
68
|
+
# Discover and write extension JavaScript files
|
|
69
|
+
required_extensions = _discover_required_extensions(view)
|
|
70
|
+
_write_extension_files(required_extensions, tmpdir)
|
|
64
71
|
|
|
65
|
-
|
|
72
|
+
# Generate extension manifest
|
|
73
|
+
_write_extension_manifest(required_extensions, tmpdir)
|
|
74
|
+
|
|
75
|
+
zarr.consolidate_metadata(zarr_group._zarr_group.store)
|
|
76
|
+
finally:
|
|
77
|
+
if _check_zarr_version() == 3:
|
|
78
|
+
zarr.config.set({"default_zarr_format": old_default_zarr_format})
|
|
66
79
|
|
|
67
80
|
|
|
68
81
|
def _discover_required_extensions(view: FigpackView) -> Set[str]:
|
|
@@ -75,7 +88,8 @@ def _discover_required_extensions(view: FigpackView) -> Set[str]:
|
|
|
75
88
|
Returns:
|
|
76
89
|
Set of extension names required by this view hierarchy
|
|
77
90
|
"""
|
|
78
|
-
|
|
91
|
+
extension_names_discovered = set()
|
|
92
|
+
extensions_discovered = []
|
|
79
93
|
visited = set() # Prevent infinite recursion
|
|
80
94
|
|
|
81
95
|
def _collect_extensions(v: FigpackView):
|
|
@@ -86,7 +100,9 @@ def _discover_required_extensions(view: FigpackView) -> Set[str]:
|
|
|
86
100
|
|
|
87
101
|
# Check if this view is an extension view
|
|
88
102
|
if isinstance(v, ExtensionView):
|
|
89
|
-
|
|
103
|
+
if v.extension.name not in extension_names_discovered:
|
|
104
|
+
extension_names_discovered.add(v.extension.name)
|
|
105
|
+
extensions_discovered.append(v.extension)
|
|
90
106
|
|
|
91
107
|
# Recursively check all attributes that might contain child views
|
|
92
108
|
for attr_name in dir(v):
|
|
@@ -121,10 +137,10 @@ def _discover_required_extensions(view: FigpackView) -> Set[str]:
|
|
|
121
137
|
continue
|
|
122
138
|
|
|
123
139
|
_collect_extensions(view)
|
|
124
|
-
return
|
|
140
|
+
return extensions_discovered
|
|
125
141
|
|
|
126
142
|
|
|
127
|
-
def _write_extension_files(
|
|
143
|
+
def _write_extension_files(extensions, tmpdir: str) -> None:
|
|
128
144
|
"""
|
|
129
145
|
Write JavaScript files for the required extensions
|
|
130
146
|
|
|
@@ -132,20 +148,11 @@ def _write_extension_files(extension_names: Set[str], tmpdir: str) -> None:
|
|
|
132
148
|
extension_names: Set of extension names to write
|
|
133
149
|
tmpdir: Directory to write extension files to
|
|
134
150
|
"""
|
|
135
|
-
if not extension_names:
|
|
136
|
-
return
|
|
137
|
-
|
|
138
|
-
registry = ExtensionRegistry.get_instance()
|
|
139
151
|
tmpdir_path = pathlib.Path(tmpdir)
|
|
140
152
|
|
|
141
|
-
for
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
raise RuntimeError(
|
|
145
|
-
f"Extension '{extension_name}' is required but not registered"
|
|
146
|
-
)
|
|
147
|
-
|
|
148
|
-
# Write the main JavaScript file
|
|
153
|
+
for extension in extensions:
|
|
154
|
+
if not isinstance(extension, FigpackExtension):
|
|
155
|
+
raise ValueError("Expected a FigpackExtension instance")
|
|
149
156
|
js_filename = extension.get_javascript_filename()
|
|
150
157
|
js_path = tmpdir_path / js_filename
|
|
151
158
|
|
|
@@ -155,7 +162,7 @@ def _write_extension_files(extension_names: Set[str], tmpdir: str) -> None:
|
|
|
155
162
|
* Version: {extension.version}
|
|
156
163
|
* Generated automatically - do not edit
|
|
157
164
|
*/
|
|
158
|
-
|
|
165
|
+
|
|
159
166
|
{extension.javascript_code}
|
|
160
167
|
"""
|
|
161
168
|
|
|
@@ -178,3 +185,43 @@ def _write_extension_files(extension_names: Set[str], tmpdir: str) -> None:
|
|
|
178
185
|
"""
|
|
179
186
|
|
|
180
187
|
additional_path.write_text(additional_js_content, encoding="utf-8")
|
|
188
|
+
|
|
189
|
+
|
|
190
|
+
def _write_extension_manifest(extensions, tmpdir: str) -> None:
|
|
191
|
+
"""
|
|
192
|
+
Write the extension manifest file that lists all extensions and their files
|
|
193
|
+
|
|
194
|
+
Args:
|
|
195
|
+
extensions: List of FigpackExtension instances
|
|
196
|
+
tmpdir: Directory to write the manifest file to
|
|
197
|
+
"""
|
|
198
|
+
tmpdir_path = pathlib.Path(tmpdir)
|
|
199
|
+
manifest_path = tmpdir_path / "extension_manifest.json"
|
|
200
|
+
|
|
201
|
+
# Build the manifest data
|
|
202
|
+
manifest_data = {"extensions": []}
|
|
203
|
+
|
|
204
|
+
for extension in extensions:
|
|
205
|
+
if not isinstance(extension, FigpackExtension):
|
|
206
|
+
raise ValueError("Expected a FigpackExtension instance")
|
|
207
|
+
|
|
208
|
+
# Get the main script filename
|
|
209
|
+
main_script = extension.get_javascript_filename()
|
|
210
|
+
|
|
211
|
+
# Get additional script filenames
|
|
212
|
+
additional_filenames = extension.get_additional_filenames()
|
|
213
|
+
additional_scripts = list(additional_filenames.values())
|
|
214
|
+
|
|
215
|
+
extension_entry = {
|
|
216
|
+
"name": extension.name,
|
|
217
|
+
"mainScript": main_script,
|
|
218
|
+
"additionalScripts": additional_scripts,
|
|
219
|
+
"version": extension.version,
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
manifest_data["extensions"].append(extension_entry)
|
|
223
|
+
|
|
224
|
+
# Write the manifest file
|
|
225
|
+
manifest_path.write_text(
|
|
226
|
+
json.dumps(manifest_data, indent=2, ensure_ascii=False), encoding="utf-8"
|
|
227
|
+
)
|
figpack/core/_view_figure.py
CHANGED
|
@@ -109,7 +109,7 @@ def view_figure(figure_path: str, port: Union[int, None] = None) -> None:
|
|
|
109
109
|
|
|
110
110
|
try:
|
|
111
111
|
with tarfile.open(figure_path, "r:gz") as tar:
|
|
112
|
-
tar.extractall(temp_path)
|
|
112
|
+
tar.extractall(temp_path, filter="data")
|
|
113
113
|
|
|
114
114
|
# Count extracted files
|
|
115
115
|
extracted_files = list(temp_path.rglob("*"))
|
figpack/core/extension_view.py
CHANGED
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
Base class for views that use figpack extensions
|
|
3
3
|
"""
|
|
4
4
|
|
|
5
|
-
import zarr
|
|
6
5
|
from .figpack_view import FigpackView
|
|
7
|
-
from .figpack_extension import
|
|
6
|
+
from .figpack_extension import FigpackExtension
|
|
7
|
+
from ..core.zarr import Group
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
class ExtensionView(FigpackView):
|
|
@@ -12,7 +12,7 @@ class ExtensionView(FigpackView):
|
|
|
12
12
|
Base class for views that are rendered by figpack extensions
|
|
13
13
|
"""
|
|
14
14
|
|
|
15
|
-
def __init__(self, *,
|
|
15
|
+
def __init__(self, *, extension: FigpackExtension, view_type: str):
|
|
16
16
|
"""
|
|
17
17
|
Initialize an extension-based view
|
|
18
18
|
|
|
@@ -20,19 +20,10 @@ class ExtensionView(FigpackView):
|
|
|
20
20
|
extension_name: Name of the extension that will render this view
|
|
21
21
|
"""
|
|
22
22
|
super().__init__()
|
|
23
|
-
self.extension_name = extension_name
|
|
24
|
-
|
|
25
|
-
# Validate that the extension is registered
|
|
26
|
-
registry = ExtensionRegistry.get_instance()
|
|
27
|
-
extension = registry.get_extension(extension_name)
|
|
28
|
-
if extension is None:
|
|
29
|
-
raise ValueError(
|
|
30
|
-
f"Extension '{extension_name}' is not registered. "
|
|
31
|
-
f"Make sure to register the extension before creating views that use it."
|
|
32
|
-
)
|
|
33
23
|
self.extension = extension
|
|
24
|
+
self.view_type = view_type
|
|
34
25
|
|
|
35
|
-
def _write_to_zarr_group(self, group:
|
|
26
|
+
def _write_to_zarr_group(self, group: Group) -> None:
|
|
36
27
|
"""
|
|
37
28
|
Write the extension view metadata to a Zarr group.
|
|
38
29
|
Subclasses should call super()._write_to_zarr_group(group) first,
|
|
@@ -42,18 +33,9 @@ class ExtensionView(FigpackView):
|
|
|
42
33
|
group: Zarr group to write data into
|
|
43
34
|
"""
|
|
44
35
|
# Set the view type to indicate this is an extension view
|
|
45
|
-
group.attrs["view_type"] =
|
|
36
|
+
group.attrs["view_type"] = self.view_type
|
|
46
37
|
|
|
47
38
|
# Store the extension name so the frontend knows which extension to use
|
|
48
|
-
group.attrs["extension_name"] = self.
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
group.attrs["additional_script_names"] = list(
|
|
52
|
-
self.extension.get_additional_filenames().keys()
|
|
53
|
-
)
|
|
54
|
-
|
|
55
|
-
# Store extension metadata for debugging/compatibility
|
|
56
|
-
registry = ExtensionRegistry.get_instance()
|
|
57
|
-
extension = registry.get_extension(self.extension_name)
|
|
58
|
-
if extension:
|
|
59
|
-
group.attrs["extension_version"] = extension.version
|
|
39
|
+
group.attrs["extension_name"] = self.extension.name
|
|
40
|
+
|
|
41
|
+
group.attrs["extension_version"] = self.extension.version
|
|
@@ -64,74 +64,3 @@ class FigpackExtension:
|
|
|
64
64
|
original_name: f"extension-{safe_name}-{original_name}"
|
|
65
65
|
for original_name in self.additional_files.keys()
|
|
66
66
|
}
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
class ExtensionRegistry:
|
|
70
|
-
"""
|
|
71
|
-
Singleton registry for managing figpack extensions
|
|
72
|
-
"""
|
|
73
|
-
|
|
74
|
-
_instance: Optional["ExtensionRegistry"] = None
|
|
75
|
-
|
|
76
|
-
def __init__(self):
|
|
77
|
-
self._extensions: Dict[str, FigpackExtension] = {}
|
|
78
|
-
|
|
79
|
-
@classmethod
|
|
80
|
-
def get_instance(cls) -> "ExtensionRegistry":
|
|
81
|
-
"""Get the singleton instance of the extension registry"""
|
|
82
|
-
if cls._instance is None:
|
|
83
|
-
cls._instance = cls()
|
|
84
|
-
return cls._instance
|
|
85
|
-
|
|
86
|
-
@classmethod
|
|
87
|
-
def register(cls, extension: FigpackExtension) -> None:
|
|
88
|
-
"""
|
|
89
|
-
Register an extension with the global registry
|
|
90
|
-
|
|
91
|
-
Args:
|
|
92
|
-
extension: The extension to register
|
|
93
|
-
"""
|
|
94
|
-
registry = cls.get_instance()
|
|
95
|
-
registry._register_extension(extension)
|
|
96
|
-
|
|
97
|
-
def _register_extension(self, extension: FigpackExtension) -> None:
|
|
98
|
-
"""
|
|
99
|
-
Internal method to register an extension
|
|
100
|
-
|
|
101
|
-
Args:
|
|
102
|
-
extension: The extension to register
|
|
103
|
-
"""
|
|
104
|
-
if extension.name in self._extensions:
|
|
105
|
-
existing = self._extensions[extension.name]
|
|
106
|
-
if existing.version != extension.version:
|
|
107
|
-
print(
|
|
108
|
-
f"Warning: Replacing extension '{extension.name}' "
|
|
109
|
-
f"version {existing.version} with version {extension.version}"
|
|
110
|
-
)
|
|
111
|
-
|
|
112
|
-
self._extensions[extension.name] = extension
|
|
113
|
-
|
|
114
|
-
def get_extension(self, name: str) -> Optional[FigpackExtension]:
|
|
115
|
-
"""
|
|
116
|
-
Get an extension by name
|
|
117
|
-
|
|
118
|
-
Args:
|
|
119
|
-
name: Name of the extension to retrieve
|
|
120
|
-
|
|
121
|
-
Returns:
|
|
122
|
-
The extension if found, None otherwise
|
|
123
|
-
"""
|
|
124
|
-
return self._extensions.get(name)
|
|
125
|
-
|
|
126
|
-
def get_all_extensions(self) -> Dict[str, FigpackExtension]:
|
|
127
|
-
"""
|
|
128
|
-
Get all registered extensions
|
|
129
|
-
|
|
130
|
-
Returns:
|
|
131
|
-
Dictionary mapping extension names to extension objects
|
|
132
|
-
"""
|
|
133
|
-
return self._extensions.copy()
|
|
134
|
-
|
|
135
|
-
def clear(self) -> None:
|
|
136
|
-
"""Clear all registered extensions (mainly for testing)"""
|
|
137
|
-
self._extensions.clear()
|
figpack/core/figpack_view.py
CHANGED
|
@@ -7,7 +7,7 @@ import random
|
|
|
7
7
|
import string
|
|
8
8
|
from typing import Union
|
|
9
9
|
|
|
10
|
-
import
|
|
10
|
+
from .zarr import Group
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
class FigpackView:
|
|
@@ -155,7 +155,7 @@ class FigpackView:
|
|
|
155
155
|
|
|
156
156
|
_save_figure(self, output_path, title=title)
|
|
157
157
|
|
|
158
|
-
def _write_to_zarr_group(self, group:
|
|
158
|
+
def _write_to_zarr_group(self, group: Group) -> None:
|
|
159
159
|
"""
|
|
160
160
|
Write the view data to a Zarr group. Must be implemented by subclasses.
|
|
161
161
|
|
figpack/core/zarr.py
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
from typing import Any, Dict
|
|
2
|
+
import zarr
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
_UNSPECIFIED = object()
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class Group:
|
|
9
|
+
def __init__(self, zarr_group: zarr.Group):
|
|
10
|
+
self._zarr_group = zarr_group
|
|
11
|
+
|
|
12
|
+
def create_group(self, name: str) -> "Group":
|
|
13
|
+
return Group(self._zarr_group.create_group(name))
|
|
14
|
+
|
|
15
|
+
def create_dataset(
|
|
16
|
+
self,
|
|
17
|
+
name: str,
|
|
18
|
+
*,
|
|
19
|
+
data=_UNSPECIFIED,
|
|
20
|
+
dtype=_UNSPECIFIED,
|
|
21
|
+
chunks=_UNSPECIFIED,
|
|
22
|
+
compressor=_UNSPECIFIED,
|
|
23
|
+
) -> None:
|
|
24
|
+
kwargs = {}
|
|
25
|
+
if data is not _UNSPECIFIED:
|
|
26
|
+
kwargs["data"] = data
|
|
27
|
+
if dtype is not _UNSPECIFIED:
|
|
28
|
+
kwargs["dtype"] = dtype
|
|
29
|
+
if chunks is not _UNSPECIFIED:
|
|
30
|
+
kwargs["chunks"] = chunks
|
|
31
|
+
if compressor is not _UNSPECIFIED:
|
|
32
|
+
kwargs["compressor"] = compressor
|
|
33
|
+
if _check_zarr_version() == 2:
|
|
34
|
+
self._zarr_group.create_dataset(name, **kwargs)
|
|
35
|
+
elif _check_zarr_version() == 3:
|
|
36
|
+
self._zarr_group.create_array(name, **kwargs)
|
|
37
|
+
else:
|
|
38
|
+
raise RuntimeError("Unsupported Zarr version")
|
|
39
|
+
|
|
40
|
+
@property
|
|
41
|
+
def attrs(self) -> Dict[str, Any]:
|
|
42
|
+
return self._zarr_group.attrs
|
|
43
|
+
|
|
44
|
+
def __getitem__(self, key: str) -> Any:
|
|
45
|
+
return self._zarr_group[key]
|
|
46
|
+
|
|
47
|
+
# implement in operator
|
|
48
|
+
def __contains__(self, key: str) -> bool:
|
|
49
|
+
return key in self._zarr_group
|
|
50
|
+
|
|
51
|
+
def __iter__(self):
|
|
52
|
+
return iter(self._zarr_group)
|
|
53
|
+
|
|
54
|
+
def __reversed__(self):
|
|
55
|
+
return reversed(self._zarr_group)
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
def _check_zarr_version():
|
|
59
|
+
version = zarr.__version__
|
|
60
|
+
major_version = int(version.split(".")[0])
|
|
61
|
+
return major_version
|