Skip to content

Instantly share code, notes, and snippets.

@Voronenko
Last active September 25, 2017 09:53
Show Gist options
  • Save Voronenko/b51960cac286fa726bfba60804d8e529 to your computer and use it in GitHub Desktop.
Save Voronenko/b51960cac286fa726bfba60804d8e529 to your computer and use it in GitHub Desktop.
XLDeploy inspect globals with jython
# #######################
import inspect
def dig(obj):
if not inspect.ismodule(obj) and not inspect.isclass(obj) and not inspect.isroutine(obj):
if isinstance(obj, str) or isinstance(obj, unicode):
print "STRING OBJECT, VALUE : " + str(obj)
else:
print "COMPLEX OBJECT, TYPE : " + str(type(obj))
if dir(obj).__contains__("_delegate"):
try:
for item in inspect.getmembers(obj._delegate):
if not inspect.isroutine(item[1]) and not inspect.isclass(item[1]) and (str(item[0]) not in ["__doc__"]):
print "Property : " + item[0] + " || VALUE : " + str(item[1])
if inspect.ismethod(item[1]) and (str(item[0]) not in ["hashCode","getClass","notify","notifyAll","equals","toString","wait","__init__","compareTo"]):
print "Method : " + item[0] + "(...)"
except :
print "ERROR : Can't review properties on object due to exception"
# ########################
import inspect
def dig(i,obj):
if not inspect.ismodule(obj) and not inspect.isclass(obj) and not inspect.isroutine(obj):
if isinstance(obj, str) or isinstance(obj, unicode):
print "STRING OBJECT : " + i + " || VALUE : " + str(obj)
else:
print "COMPLEX OBJECT : " + i + " || TYPE : " + str(type(obj))
if dir(obj).__contains__("_delegate"):
try:
for item in inspect.getmembers(obj._delegate):
if not inspect.isroutine(item[1]) and not inspect.isclass(item[1]) and (str(item[0]) not in ["__doc__"]):
print "Property : " + i + "." + item[0] + " || VALUE : " + str(item[1])
if inspect.ismethod(item[1]) and (str(item[0]) not in ["hashCode","getClass","notify","notifyAll","equals","toString","wait","__init__","compareTo"]):
print "Method : " + i + "." + item[0] + "(...)"
except :
print "ERROR : Can't review properties on object " + i + " due to exception"
for i in globals():
dig(i, globals()[i])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment