Skip to content

Commit 74e0c0b

Browse files
scarf005joowani
authored andcommitted
Account for deprecation of DiGraph._repr_svg_ in graphviz
1 parent 397e65f commit 74e0c0b

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ repos:
1212
- id: end-of-file-fixer
1313
- id: mixed-line-ending
1414
- repo: https://github.com/psf/black
15-
rev: 22.1.0
15+
rev: 22.3.0
1616
hooks:
1717
- id: black
1818
- repo: https://github.com/timothycrosley/isort

binarytree/__init__.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -508,8 +508,12 @@ def _repr_svg_(self) -> str: # pragma: no cover
508508
.. _Jupyter notebooks: https://jupyter.org
509509
"""
510510
try:
511-
# noinspection PyProtectedMember
512-
return str(self.graphviz()._repr_svg_())
511+
try:
512+
# noinspection PyProtectedMember
513+
return str(self.graphviz()._repr_svg_())
514+
except AttributeError:
515+
# noinspection PyProtectedMember
516+
return str(self.graphviz()._repr_image_svg_xml())
513517

514518
except (SubprocessError, ExecutableNotFound, FileNotFoundError):
515519
return self.svg()

0 commit comments

Comments
 (0)