From fca0f37b6e11ca5603328430b80401444165c9f3 2021-11-26 23:29:09 From: Ahmed Fasih Date: 2021-11-26 23:29:09 Subject: [PATCH] avoid mutable default argument! --- diff --git a/IPython/core/interactiveshell.py b/IPython/core/interactiveshell.py index 7d3d003..8390d02 100644 --- a/IPython/core/interactiveshell.py +++ b/IPython/core/interactiveshell.py @@ -1804,7 +1804,7 @@ class InteractiveShell(SingletonConfigurable): """Get object info as formatted text""" return self.object_inspect_mime(oname, detail_level)['text/plain'] - def object_inspect_mime(self, oname, detail_level=0, omit_sections={}): + def object_inspect_mime(self, oname, detail_level=0, omit_sections=()): """Get object info as a mimebundle of formatted representations. A mimebundle is a dictionary, keyed by mime-type. diff --git a/IPython/core/oinspect.py b/IPython/core/oinspect.py index 74b3cc9..3f12d51 100644 --- a/IPython/core/oinspect.py +++ b/IPython/core/oinspect.py @@ -567,7 +567,7 @@ class Inspector(Colorable): return bundle def _get_info( - self, obj, oname="", formatter=None, info=None, detail_level=0, omit_sections={} + self, obj, oname="", formatter=None, info=None, detail_level=0, omit_sections=() ): """Retrieve an info dict and format it. @@ -583,8 +583,8 @@ class Inspector(Colorable): already computed information detail_level: integer Granularity of detail level, if set to 1, give more information. - omit_sections: set[str] - Titles or keys to omit from output + omit_sections: container[str] + Titles or keys to omit from output (can be set, tuple, etc., anything supporting `in`) """ info = self._info(obj, oname=oname, info=info, detail_level=detail_level) @@ -669,7 +669,7 @@ class Inspector(Colorable): info=None, detail_level=0, enable_html_pager=True, - omit_sections={}, + omit_sections=(), ): """Show detailed information about an object.