Skip to content

Commit

Permalink
fix(import-project): use label row metadatas from new sdk version (#271)
Browse files Browse the repository at this point in the history
  • Loading branch information
Encord-davids authored Mar 21, 2023
1 parent 6d6cfe4 commit 292bfaa
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/encord_active/lib/project/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
download_file,
slice_video_into_frames,
)
from encord_active.lib.encord.local_sdk import handle_enum_and_datetime
from encord_active.lib.project.metadata import fetch_project_meta
from encord_active.lib.project.project_file_structure import ProjectFileStructure

Expand Down Expand Up @@ -129,9 +130,12 @@ def __load_ontology(self):
self.ontology = OntologyStructure.from_dict(json.loads(ontology_file_path.read_text(encoding="utf-8")))

def __save_label_row_meta(self, encord_project: EncordProject):
label_row_meta = {lr["label_hash"]: lr for lr in encord_project.label_rows if lr["label_hash"] is not None}
label_row_meta_file_path = self.file_structure.label_row_meta
label_row_meta_file_path.write_text(json.dumps(label_row_meta, indent=2), encoding="utf-8")
label_row_meta = {
lrm.label_hash: handle_enum_and_datetime(lrm)
for lrm in encord_project.list_label_rows()
if lrm.label_hash is not None
}
self.file_structure.label_row_meta.write_text(json.dumps(label_row_meta, indent=2), encoding="utf-8")

def __load_label_row_meta(self, subset_size: Optional[int]):
label_row_meta_file_path = self.file_structure.label_row_meta
Expand Down

0 comments on commit 292bfaa

Please sign in to comment.