|
1 | 1 | import json |
2 | 2 | import re |
3 | | -from typing import Optional, Tuple, Union |
| 3 | +from typing import Any, Optional, Tuple, Union |
4 | 4 |
|
5 | 5 | import numcodecs |
6 | 6 | import orjson |
7 | | -import pydantic_settings |
8 | 7 | from fastapi import APIRouter, Depends, HTTPException, Request |
9 | 8 | from starlette.responses import Response |
10 | 9 | from starlette.status import HTTP_400_BAD_REQUEST, HTTP_500_INTERNAL_SERVER_ERROR |
11 | 10 |
|
| 11 | +from tiled.adapters.core import Adapter |
| 12 | + |
12 | 13 | from ..structures.core import StructureFamily |
13 | 14 | from ..type_aliases import AccessTags, Scopes |
14 | 15 | from ..utils import ensure_awaitable |
@@ -58,7 +59,7 @@ async def get_zarr_attrs( |
58 | 59 | principal: Union[Principal] = Depends(get_current_principal), |
59 | 60 | authn_access_tags: Optional[AccessTags] = Depends(get_current_access_tags), |
60 | 61 | authn_scopes: Scopes = Depends(get_current_scopes), |
61 | | - root_tree: pydantic_settings.BaseSettings = Depends(get_root_tree), |
| 62 | + root_tree: Adapter[Any] = Depends(get_root_tree), |
62 | 63 | session_state: dict = Depends(get_session_state), |
63 | 64 | ): |
64 | 65 | "Return entry.metadata as Zarr attributes metadata (.zattrs)" |
@@ -94,7 +95,7 @@ async def get_zarr_group_metadata( |
94 | 95 | principal: Union[Principal] = Depends(get_current_principal), |
95 | 96 | authn_access_tags: Optional[AccessTags] = Depends(get_current_access_tags), |
96 | 97 | authn_scopes: Scopes = Depends(get_current_scopes), |
97 | | - root_tree: pydantic_settings.BaseSettings = Depends(get_root_tree), |
| 98 | + root_tree: Adapter[Any] = Depends(get_root_tree), |
98 | 99 | session_state: dict = Depends(get_session_state), |
99 | 100 | ): |
100 | 101 | await get_entry( |
@@ -122,7 +123,7 @@ async def get_zarr_array_metadata( |
122 | 123 | principal: Union[Principal] = Depends(get_current_principal), |
123 | 124 | authn_access_tags: Optional[AccessTags] = Depends(get_current_access_tags), |
124 | 125 | authn_scopes: Scopes = Depends(get_current_scopes), |
125 | | - root_tree: pydantic_settings.BaseSettings = Depends(get_root_tree), |
| 126 | + root_tree: Adapter[Any] = Depends(get_root_tree), |
126 | 127 | session_state: dict = Depends(get_session_state), |
127 | 128 | ): |
128 | 129 | entry = await get_entry( |
@@ -166,7 +167,7 @@ async def get_zarr_array( |
166 | 167 | principal: Union[Principal] = Depends(get_current_principal), |
167 | 168 | authn_access_tags: Optional[AccessTags] = Depends(get_current_access_tags), |
168 | 169 | authn_scopes: Scopes = Depends(get_current_scopes), |
169 | | - root_tree: pydantic_settings.BaseSettings = Depends(get_root_tree), |
| 170 | + root_tree: Adapter[Any] = Depends(get_root_tree), |
170 | 171 | session_state: dict = Depends(get_session_state), |
171 | 172 | ): |
172 | 173 | # If a zarr block is requested, e.g. http://localhost:8000/zarr/v2/array/0.1.2.3, |
@@ -285,7 +286,7 @@ async def get_zarr_metadata( |
285 | 286 | principal: Union[Principal] = Depends(get_current_principal), |
286 | 287 | authn_access_tags: Optional[AccessTags] = Depends(get_current_access_tags), |
287 | 288 | authn_scopes: Scopes = Depends(get_current_scopes), |
288 | | - root_tree: pydantic_settings.BaseSettings = Depends(get_root_tree), |
| 289 | + root_tree: Adapter[Any] = Depends(get_root_tree), |
289 | 290 | session_state: dict = Depends(get_session_state), |
290 | 291 | ): |
291 | 292 | from zarr.dtype import parse_data_type |
@@ -377,7 +378,7 @@ async def get_zarr_array( |
377 | 378 | principal: Union[Principal] = Depends(get_current_principal), |
378 | 379 | authn_access_tags: Optional[AccessTags] = Depends(get_current_access_tags), |
379 | 380 | authn_scopes: Scopes = Depends(get_current_scopes), |
380 | | - root_tree: pydantic_settings.BaseSettings = Depends(get_root_tree), |
| 381 | + root_tree: Adapter[Any] = Depends(get_root_tree), |
381 | 382 | session_state: dict = Depends(get_session_state), |
382 | 383 | ): |
383 | 384 | entry = await get_entry( |
@@ -458,7 +459,7 @@ async def get_zarr_group( |
458 | 459 | principal: Union[Principal] = Depends(get_current_principal), |
459 | 460 | authn_access_tags: Optional[AccessTags] = Depends(get_current_access_tags), |
460 | 461 | authn_scopes: Scopes = Depends(get_current_scopes), |
461 | | - root_tree: pydantic_settings.BaseSettings = Depends(get_root_tree), |
| 462 | + root_tree: Adapter[Any] = Depends(get_root_tree), |
462 | 463 | session_state: dict = Depends(get_session_state), |
463 | 464 | ): |
464 | 465 | entry = await get_entry( |
|
0 commit comments