Skip to content

Commit

Permalink
Fix svg_from_json (#990)
Browse files Browse the repository at this point in the history
* rm proto_to_svg

* fix make_svg => _make_svg

* fix args

* Apply formatter

Co-authored-by: GitHub Actions <41898282+github-actions[bot]@users.noreply.github.com>
  • Loading branch information
sotetsuk and github-actions[bot] authored Oct 19, 2021
1 parent 7782f62 commit 1b890f6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
8 changes: 0 additions & 8 deletions mjx/visualizer/proto_to_svg.py

This file was deleted.

6 changes: 6 additions & 0 deletions mjx/visualizer/svg.py
Original file line number Diff line number Diff line change
Expand Up @@ -843,6 +843,12 @@ def _make_svg(
return dwg


def svg_from_json(json_data: str, target_idx: Optional[int] = None) -> str:
proto_data = MahjongTable.json_to_proto(json_data=json_data)
dwg = _make_svg(proto_data, ".svg", target_idx)
return '<?xml version="1.0" encoding="utf-8" ?>\n' + dwg.tostring()


def save_svg(
proto_data: Union[mjxproto.State, mjxproto.Observation],
filename: str,
Expand Down

0 comments on commit 1b890f6

Please sign in to comment.