Skip to content

Commit

Permalink
refact: remove bentio meta dict type
Browse files Browse the repository at this point in the history
  • Loading branch information
davidlougheed committed Apr 17, 2024
1 parent 41b6985 commit 082cb14
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 15 deletions.
18 changes: 8 additions & 10 deletions chord_drs/serialization.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

from .data_sources import DATA_SOURCE_LOCAL, DATA_SOURCE_MINIO
from .models import DrsMixin, DrsBlob, DrsBundle
from .types import DRSAccessMethodDict, DRSContentsDict, DRSObjectBentoMetaDict, DRSObjectDict
from .types import DRSAccessMethodDict, DRSContentsDict, DRSObjectBentoDict, DRSObjectDict


__all__ = [
Expand Down Expand Up @@ -51,14 +51,12 @@ def build_contents(bundle: DrsBundle, expand: bool) -> list[DRSContentsDict]:
return content


def build_bento_object_json(drs_object: DrsMixin) -> DRSObjectBentoMetaDict:
def build_bento_object_json(drs_object: DrsMixin) -> DRSObjectBentoDict:
return {
"bento": {
"project_id": drs_object.project_id,
"dataset_id": drs_object.dataset_id,
"data_type": drs_object.data_type,
"public": drs_object.public,
}
"project_id": drs_object.project_id,
"dataset_id": drs_object.dataset_id,
"data_type": drs_object.data_type,
"public": drs_object.public,
}


Expand All @@ -82,7 +80,7 @@ def build_bundle_json(
**({"description": drs_bundle.description} if drs_bundle.description is not None else {}),
"id": drs_bundle.id,
"self_uri": create_drs_uri(drs_bundle.id),
**(build_bento_object_json(drs_bundle) if with_bento_properties else {}),
**({"bento": build_bento_object_json(drs_bundle)} if with_bento_properties else {}),
}


Expand Down Expand Up @@ -145,5 +143,5 @@ def build_blob_json(
**({"description": drs_blob.description} if drs_blob.description is not None else {}),
"id": drs_blob.id,
"self_uri": create_drs_uri(drs_blob.id),
**(build_bento_object_json(drs_blob) if with_bento_properties else {}),
**({"bento": build_bento_object_json(drs_blob)} if with_bento_properties else {}),
}
5 changes: 0 additions & 5 deletions chord_drs/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
"DRSChecksumDict",
"DRSContentsDict",
"DRSObjectBentoDict",
"DRSObjectBentoMetaDict",
"DRSObjectDict",
]

Expand Down Expand Up @@ -61,10 +60,6 @@ class DRSObjectBentoDict(TypedDict):
public: bool


class DRSObjectBentoMetaDict(TypedDict):
bento: DRSObjectBentoDict


class DRSObjectDict(_DRSObjectDictBase, total=False):
access_methods: list[DRSAccessMethodDict]
name: str
Expand Down

0 comments on commit 082cb14

Please sign in to comment.