Skip to content

Commit

Permalink
make it pass tests
Browse files Browse the repository at this point in the history
  • Loading branch information
skshetry committed Mar 5, 2024
1 parent d5b2fb6 commit 7b5a55a
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion dvc/render/convert.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def to_json(renderer, split: bool = False) -> list[dict]:
{
TYPE_KEY: renderer.TYPE,
REVISIONS: [datapoint.get(REVISION)],
**datapoint.get(ANNOTATIONS),
**datapoint.get(ANNOTATIONS, {}),
"url": datapoint.get(SRC),
}
for datapoint in renderer.datapoints
Expand Down
6 changes: 4 additions & 2 deletions dvc/render/converter/image.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ def flat_datapoints(self, revision: str) -> tuple[list[dict], dict]:
datapoints = []
datas, properties = self.convert()

annotations = {}
if "annotations" in properties:
annotations = self._load_annotations(properties["annotations"])

Expand All @@ -67,12 +68,13 @@ def flat_datapoints(self, revision: str) -> tuple[list[dict], dict]:
)
else:
src = self._encode_image(image_content)
datapoint = {
datapoint: dict[str, Any] = {
REVISION: revision,
FILENAME: filename,
SRC: src,
ANNOTATIONS: annotations,
}
if annotations:
datapoint[ANNOTATIONS] = annotations
datapoints.append(datapoint)
return datapoints, properties

Expand Down
1 change: 1 addition & 0 deletions dvc/repo/plots/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -489,6 +489,7 @@ def _closest_parent(fs, path, parents):
best_result = common_path
return best_result


def _add_annotations_to_image_definition(target):
if "data" not in target:
return target
Expand Down

0 comments on commit 7b5a55a

Please sign in to comment.