diff options
author | robot-piglet <robot-piglet@yandex-team.com> | 2024-12-18 11:04:10 +0300 |
---|---|---|
committer | robot-piglet <robot-piglet@yandex-team.com> | 2024-12-18 11:18:13 +0300 |
commit | dcbf444872b81248ce958f05d47abad6e8a237a7 (patch) | |
tree | a93610b3dd80f19c5116e4e5885ea2783f6166d3 /contrib/python/ipython/py3/IPython/core/display.py | |
parent | e2c38d5aa55a58da33c1dc54792c131023bb7472 (diff) | |
download | ydb-dcbf444872b81248ce958f05d47abad6e8a237a7.tar.gz |
Intermediate changes
commit_hash:1f2ebe313aea1039145a9d68dcd511d5f22f383a
Diffstat (limited to 'contrib/python/ipython/py3/IPython/core/display.py')
-rw-r--r-- | contrib/python/ipython/py3/IPython/core/display.py | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/contrib/python/ipython/py3/IPython/core/display.py b/contrib/python/ipython/py3/IPython/core/display.py index c3c44016f4..a9434473a8 100644 --- a/contrib/python/ipython/py3/IPython/core/display.py +++ b/contrib/python/ipython/py3/IPython/core/display.py @@ -16,7 +16,8 @@ from copy import deepcopy from os.path import splitext from pathlib import Path, PurePath -from IPython.utils.py3compat import cast_unicode +from typing import Optional + from IPython.testing.skipdoctest import skip_doctest from . import display_functions @@ -518,7 +519,7 @@ class SVG(DisplayObject): _read_flags = 'rb' # wrap data in a property, which extracts the <svg> tag, discarding # document headers - _data = None + _data: Optional[str] = None @property def data(self): @@ -540,8 +541,10 @@ class SVG(DisplayObject): # fallback on the input, trust the user # but this is probably an error. pass - svg = cast_unicode(svg) - self._data = svg + if isinstance(svg, bytes): + self._data = svg.decode(errors="replace") + else: + self._data = svg def _repr_svg_(self): return self._data_and_metadata() |