Skip to content

Commit

Permalink
deps: bump dvc-render>=0.3.1<0.4.0.
Browse files Browse the repository at this point in the history
  • Loading branch information
daavoo committed Mar 16, 2023
1 parent 58029e9 commit 79135ff
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 10 deletions.
3 changes: 1 addition & 2 deletions dvc/commands/plots.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import argparse
import json
import logging
import os

Expand Down Expand Up @@ -136,7 +135,7 @@ def run(self) -> int: # noqa: C901, PLR0911, PLR0912
if self.args.show_vega:
renderer = first(filter(lambda r: r.TYPE == "vega", renderers))
if renderer:
ui.write_json(json.loads(renderer.get_filled_template()))
ui.write_json(renderer.get_filled_template(as_string=False))
return 0

output_file: Path = (Path.cwd() / out).resolve() / "index.html"
Expand Down
9 changes: 5 additions & 4 deletions dvc/render/convert.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import json
from collections import defaultdict
from typing import Dict, List, Union

Expand Down Expand Up @@ -32,15 +31,17 @@ def to_json(renderer, split: bool = False) -> List[Dict]:
if renderer.TYPE == "vega":
grouped = _group_by_rev(renderer.datapoints)
if split:
content = renderer.get_filled_template(skip_anchors=["data"])
content = renderer.get_filled_template(
skip_anchors=["data"], as_string=False
)
else:
content = renderer.get_filled_template()
content = renderer.get_filled_template(as_string=False)
if grouped:
return [
{
TYPE_KEY: renderer.TYPE,
REVISIONS_KEY: sorted(grouped.keys()),
"content": json.loads(content),
"content": content,
"datapoints": grouped,
}
]
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ dependencies = [
"dpath<3,>=2.1.0",
"dvc-data>=0.44.0,<0.45",
"dvc-http",
"dvc-render>=0.1.2",
"dvc-render>=0.3.1,<0.4.0",
"dvc-studio-client>=0.5.0,<1",
"dvc-task>=0.2.0,<1",
"flatten_dict<1,>=0.4.1",
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/command/test_plots.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ def test_plots_diff_vega(dvc, mocker, capsys, plots_data):
mocker.patch("dvc.repo.plots.diff.diff", return_value=plots_data)
mocker.patch(
"dvc_render.VegaRenderer.get_filled_template",
return_value=json.dumps({"this": "is vega json"}),
return_value={"this": "is vega json"},
)
render_mock = mocker.patch("dvc_render.render_html")
assert cmd.run() == 0
Expand Down
4 changes: 2 additions & 2 deletions tests/unit/render/test_convert.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
def test_to_json_vega(mocker):
vega_renderer = mocker.MagicMock()
vega_renderer.TYPE = "vega"
vega_renderer.get_filled_template.return_value = '{"this": "is vega"}'
vega_renderer.get_filled_template.return_value = {"this": "is vega"}
vega_renderer.datapoints = [
{
"x": 1,
Expand Down Expand Up @@ -50,7 +50,7 @@ def test_to_json_vega(mocker):
def test_to_json_vega_split(mocker):
vega_renderer = mocker.MagicMock()
vega_renderer.TYPE = "vega"
vega_renderer.get_filled_template.return_value = '{"this": "is split vega"}'
vega_renderer.get_filled_template.return_value = {"this": "is split vega"}
vega_renderer.datapoints = [
{
"x": 1,
Expand Down

0 comments on commit 79135ff

Please sign in to comment.