From 56a39f74f9f8cfa0361b4f09094bcdf2cad326cc Mon Sep 17 00:00:00 2001 From: Jason Grout Date: Tue, 13 Dec 2022 11:23:23 -0700 Subject: [PATCH] Fix unintentional deprecation warnings We missed a traitlet setup function that is called when the class is setup. Fixes #3648 --- python/ipywidgets/ipywidgets/widgets/widget.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/python/ipywidgets/ipywidgets/widgets/widget.py b/python/ipywidgets/ipywidgets/widgets/widget.py index f7bbdc1dd9..4f4dcb3732 100644 --- a/python/ipywidgets/ipywidgets/widgets/widget.py +++ b/python/ipywidgets/ipywidgets/widgets/widget.py @@ -310,7 +310,7 @@ def widgets(): # did not explicitly try to use this attribute, we do not want to throw a deprecation warning. # So we check if the thing calling this static property is one of the known initialization functions in traitlets. frame = _get_frame(2) - if not (frame.f_code.co_filename == TRAITLETS_FILE and (frame.f_code.co_name in ('getmembers', 'setup_instance'))): + if not (frame.f_code.co_filename == TRAITLETS_FILE and (frame.f_code.co_name in ('getmembers', 'setup_instance', 'setup_class'))): deprecation("Widget.widgets is deprecated.") return _instances @@ -320,7 +320,7 @@ def _active_widgets(): # did not explicitly try to use this attribute, we do not want to throw a deprecation warning. # So we check if the thing calling this static property is one of the known initialization functions in traitlets. frame = _get_frame(2) - if not (frame.f_code.co_filename == TRAITLETS_FILE and (frame.f_code.co_name in ('getmembers', 'setup_instance'))): + if not (frame.f_code.co_filename == TRAITLETS_FILE and (frame.f_code.co_name in ('getmembers', 'setup_instance', 'setup_class'))): deprecation("Widget._active_widgets is deprecated.") return _instances @@ -330,7 +330,7 @@ def _widget_types(): # did not explicitly try to use this attribute, we do not want to throw a deprecation warning. # So we check if the thing calling this static property is one of the known initialization functions in traitlets. frame = _get_frame(2) - if not (frame.f_code.co_filename == TRAITLETS_FILE and (frame.f_code.co_name in ('getmembers', 'setup_instance'))): + if not (frame.f_code.co_filename == TRAITLETS_FILE and (frame.f_code.co_name in ('getmembers', 'setup_instance', 'setup_class'))): deprecation("Widget._widget_types is deprecated.") return _registry @@ -340,7 +340,7 @@ def widget_types(): # did not explicitly try to use this attribute, we do not want to throw a deprecation warning. # So we check if the thing calling this static property is one of the known initialization functions in traitlets. frame = _get_frame(2) - if not (frame.f_code.co_filename == TRAITLETS_FILE and (frame.f_code.co_name in ('getmembers', 'setup_instance'))): + if not (frame.f_code.co_filename == TRAITLETS_FILE and (frame.f_code.co_name in ('getmembers', 'setup_instance', 'setup_class'))): deprecation("Widget.widget_types is deprecated.") return _registry