From 85262398e7ccf2f781edb44d62303a9a4922f6f9 Mon Sep 17 00:00:00 2001 From: Sven Augustin Date: Sun, 24 Oct 2021 13:01:36 +0200 Subject: [PATCH] ignore modules --- inspector.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/inspector.py b/inspector.py index 6074c9d..6005d99 100644 --- a/inspector.py +++ b/inspector.py @@ -1,5 +1,6 @@ import inspect import re +import types import weakref import ipywidgets @@ -11,7 +12,7 @@ FOOTER = '' SEP = '' LINE = '{0}{1}{2}{3}' -IGNORE = ("In", "Out", "exit", "quit", "get_ipython") +IGNORE_NAMES = ("In", "Out", "exit", "quit", "get_ipython") SNIP = " ...✀... " @@ -88,7 +89,8 @@ def sorted_naturally(iterable, reverse=False): return sorted(iterable, key=natural, reverse=reverse) def is_good_entry(k, v): - return not k.startswith("_") and k not in IGNORE and not isinstance(v, VariableInspector) + ignore_types = (VariableInspector, types.ModuleType) + return not k.startswith("_") and k not in IGNORE_NAMES and not isinstance(v, ignore_types) def typename(obj): return type(obj).__name__