From 7f2253f61da333ef46df44bdbd7dcee24f0557ba Mon Sep 17 00:00:00 2001 From: Nikita Sobolev Date: Sat, 24 Jul 2021 22:05:43 +0300 Subject: [PATCH 1/4] Adds missing prop to `__slots__` of `Emoji` Refs https://github.com/python/mypy/pull/10864 --- rich/emoji.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rich/emoji.py b/rich/emoji.py index c3c844ecc7..d5a1062a96 100644 --- a/rich/emoji.py +++ b/rich/emoji.py @@ -25,7 +25,7 @@ class NoEmoji(Exception): class Emoji(JupyterMixin): - __slots__ = ["name", "style", "_char"] + __slots__ = ["name", "style", "_char", "variant"] VARIANTS = {"text": "\uFE0E", "emoji": "\uFE0F"} From 2daff6fe0f6cbea5e45ef0c9b65e3ac5a2286a5a Mon Sep 17 00:00:00 2001 From: Nikita Sobolev Date: Sat, 24 Jul 2021 22:21:25 +0300 Subject: [PATCH 2/4] Adds `__slots__` to `JupiterMixin` I am using `[]` for consistency with other `__slots__` definitions --- rich/jupyter.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/rich/jupyter.py b/rich/jupyter.py index cc02797978..807d19941a 100644 --- a/rich/jupyter.py +++ b/rich/jupyter.py @@ -30,6 +30,8 @@ def _repr_mimebundle_( class JupyterMixin: """Add to an Rich renderable to make it render in Jupyter notebook.""" + + __slots__ = [] def _repr_mimebundle_( self, include: Iterable[str], exclude: Iterable[str], **kwargs: Any From 7f7265ec4f896b39c03ff701bca9149bce4a537b Mon Sep 17 00:00:00 2001 From: Nikita Sobolev Date: Sun, 25 Jul 2021 19:27:25 +0300 Subject: [PATCH 3/4] Sorry! :) --- rich/jupyter.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rich/jupyter.py b/rich/jupyter.py index 807d19941a..fef7bb8f65 100644 --- a/rich/jupyter.py +++ b/rich/jupyter.py @@ -30,7 +30,7 @@ def _repr_mimebundle_( class JupyterMixin: """Add to an Rich renderable to make it render in Jupyter notebook.""" - + __slots__ = [] def _repr_mimebundle_( From ae5a57ea736fe1e28bd100aa8169eb0e3e44f00e Mon Sep 17 00:00:00 2001 From: Nikita Sobolev Date: Sun, 25 Jul 2021 19:52:58 +0300 Subject: [PATCH 4/4] Update jupyter.py --- rich/jupyter.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rich/jupyter.py b/rich/jupyter.py index fef7bb8f65..7cdcc9cabc 100644 --- a/rich/jupyter.py +++ b/rich/jupyter.py @@ -31,7 +31,7 @@ def _repr_mimebundle_( class JupyterMixin: """Add to an Rich renderable to make it render in Jupyter notebook.""" - __slots__ = [] + __slots__ = () def _repr_mimebundle_( self, include: Iterable[str], exclude: Iterable[str], **kwargs: Any