<%! from kaithem.src.util import url from kaithem.src import pages,unitsofmeasure,util,widgets,kaithemobj import json,re,inspect,weakref,collections,gc,traceback %> <% try: from dill.source import getsource except: getsource = None %> <%include file="/pageheader.html"/> Object Inspector

Inspecting ${objname|h}

${obj.__class__|h}
${util.saferepr(obj)|h}
%if isinstance(obj, (weakref.ref)):

Weak Reference

%endif %if hasattr(obj,'__dict__'):

Object Attributes

%for i in sorted(obj.__dict__.keys(), key=str):
${util.saferepr(obj.__dict__[i])|h}
%if hasattr(obj.__dict__[i],'__doc__'):
${obj.__dict__[i].__doc__}
%endif
%endfor %for i in['__class__','__getattr__','__setattr__', '__getattribute__',"__del__","__init__","__str__","__repr__"]: %if hasattr(obj,i):
${util.saferepr(getattr(obj,i))|h}
%endif %endfor
%endif

Objects Referring to this Object

%if getGC:
Greyed entries may be less interesting and more likely the rendering of this page itself.
%for i in gc.get_referrers(obj):
${util.saferepr(i)|h}
%endfor
%endif
%try: %if hasattr(obj,'__slots__') and obj.__slots__: %try:

Object Attributes

%for i in obj.__slots__:
${util.saferepr(getattr(obj,i))|h}
%if hasattr(getattr(obj,i),'__doc__'):
${getattr(obj,i).__doc__}
%endif
%endfor %except: ${traceback.format_exc()|h}
%endtry %for i in['__class__','__getattr__','__setattr__', '__getattribute__',"__del__","__init__","__str__","__repr__"]: %if hasattr(obj,i):
${util.saferepr(getattr(obj,i))|h}
%endif %endfor %endif %if hasattr(obj,'__doc__'):

Documentation String

${obj.__doc__}
%endif

Source Code

%if hasattr(obj,"__globals__") and 'txt' in obj.__globals__:
${util.saferepr(obj.__globals__['txt'])|h}
%elif not getsource:
%try:
${inspect.getsource(obj)|h}
%except Exception as e:

Inspect: No Source Code Found: ${e}

%endtry %else: %try: ${getsource(obj)|h} %except Exception as e:

Dill: No Source Code Found: ${e}

%endtry %endif
%if isinstance(obj, (list, collections.deque,set)):

List Contents (${len(obj)} items)

    %for n, i in enumerate(obj):
  1. %endfor
%endif %if isinstance(obj, (dict,weakref.WeakValueDictionary, weakref.WeakKeyDictionary)):

Dict Contents (${len(obj)} items)

%for i in sorted(obj.keys(),key=str): %if isinstance(i,str):
%elif isinstance(i,tuple):
%elif isinstance(i,(int,float)):
%elif isinstance(i,int):
%endif
${util.saferepr(obj[i])|h}
%endfor
%endif %except: ${traceback.format_exc()|h} %endtry