From a570c92cc0120cd965f124a3f4dce5da47f8f555 2024-03-31 12:33:28 From: M Bussonnier Date: 2024-03-31 12:33:28 Subject: [PATCH] add __repr__ to MagicsDisplay (#14378) Here's more details on the `rich` side: https://github.com/Textualize/rich/issues/3317 I don't see a good reason not to overload `__repr__` in this use case --- diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index ae1a8d7..e65f2e5 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -34,7 +34,7 @@ jobs: run: | darker -r 60625f241f298b5039cb2debc365db38aa7bb522 --check --diff . || ( echo "Changes need auto-formatting. Run:" - echo " darker -r 60625f241f298b5039cb2debc365db38aa7bb522" + echo " darker -r 60625f241f298b5039cb2debc365db38aa7bb522 ." echo "then commit and push changes to fix." exit 1 ) diff --git a/IPython/core/magics/basic.py b/IPython/core/magics/basic.py index 3ac4049..3e3eb2d 100644 --- a/IPython/core/magics/basic.py +++ b/IPython/core/magics/basic.py @@ -40,6 +40,9 @@ class MagicsDisplay(object): def _repr_pretty_(self, p, cycle): p.text(self._lsmagic()) + def __repr__(self): + return self.__str__() + def __str__(self): return self._lsmagic()