Skip to content

Commit

Permalink
Merge pull request #3 from padraic-shafer/cleanup-prep
Browse files Browse the repository at this point in the history
Misc cleanup-prep changes from bluesky#668
  • Loading branch information
danielballan authored Mar 12, 2024
2 parents d99c079 + ccfeb15 commit e6d378d
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 13 deletions.
8 changes: 5 additions & 3 deletions tiled/catalog/adapter.py
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@ async def __aiter__(self):

@property
def data_sources(self):
return [DataSource.from_orm(ds) for ds in self.node.data_sources or []]
return [DataSource.from_orm(ds) for ds in (self.node.data_sources or [])]

async def asset_by_id(self, asset_id):
statement = (
Expand Down Expand Up @@ -597,12 +597,14 @@ async def create_node(
if data_source.management != Management.external:
if structure_family == StructureFamily.container:
raise NotImplementedError(structure_family)
data_source.mimetype = DEFAULT_CREATION_MIMETYPE[structure_family]
data_source.mimetype = DEFAULT_CREATION_MIMETYPE[
data_source.structure_family
]
data_source.parameters = {}
data_uri = str(self.context.writable_storage) + "".join(
f"/{quote_plus(segment)}" for segment in (self.segments + [key])
)
init_storage = DEFAULT_INIT_STORAGE[structure_family]
init_storage = DEFAULT_INIT_STORAGE[data_source.structure_family]
assets = await ensure_awaitable(
init_storage, data_uri, data_source.structure
)
Expand Down
9 changes: 0 additions & 9 deletions tiled/server/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -704,15 +704,6 @@ class WrongTypeForRoute(Exception):
pass


FULL_LINKS = {
StructureFamily.array: {"full": "{base_url}/array/full/{path}"},
StructureFamily.awkward: {"full": "{base_url}/awkward/full/{path}"},
StructureFamily.container: {"full": "{base_url}/container/full/{path}"},
StructureFamily.table: {"full": "{base_url}/table/full/{path}"},
StructureFamily.sparse: {"full": "{base_url}/array/full/{path}"},
}


def asdict(dc):
"Compat for converting dataclass or pydantic.BaseModel to dict."
if dc is None:
Expand Down
4 changes: 3 additions & 1 deletion tiled/server/router.py
Original file line number Diff line number Diff line change
Expand Up @@ -1262,7 +1262,9 @@ async def put_array_block(
@router.put("/node/full/{path:path}", deprecated=True)
async def put_node_full(
request: Request,
entry=SecureEntry(scopes=["write:data"]),
entry=SecureEntry(
scopes=["write:data"], structure_families={StructureFamily.table}
),
deserialization_registry=Depends(get_deserialization_registry),
):
if not hasattr(entry, "write"):
Expand Down

0 comments on commit e6d378d

Please sign in to comment.