Skip to content

Commit

Permalink
Account for deprecation of DiGraph._repr_svg_ in graphviz
Browse files Browse the repository at this point in the history
  • Loading branch information
scarf005 authored and joowani committed Jun 28, 2022
1 parent 397e65f commit 74e0c0b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ repos:
- id: end-of-file-fixer
- id: mixed-line-ending
- repo: https://github.com/psf/black
rev: 22.1.0
rev: 22.3.0
hooks:
- id: black
- repo: https://github.com/timothycrosley/isort
Expand Down
8 changes: 6 additions & 2 deletions binarytree/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -508,8 +508,12 @@ def _repr_svg_(self) -> str: # pragma: no cover
.. _Jupyter notebooks: https://jupyter.org
"""
try:
# noinspection PyProtectedMember
return str(self.graphviz()._repr_svg_())
try:
# noinspection PyProtectedMember
return str(self.graphviz()._repr_svg_())
except AttributeError:
# noinspection PyProtectedMember
return str(self.graphviz()._repr_image_svg_xml())

except (SubprocessError, ExecutableNotFound, FileNotFoundError):
return self.svg()
Expand Down

0 comments on commit 74e0c0b

Please sign in to comment.