Last active
September 25, 2017 09:53
-
-
Save Voronenko/b51960cac286fa726bfba60804d8e529 to your computer and use it in GitHub Desktop.
XLDeploy inspect globals with jython
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ####################### | |
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" | |
# ######################## |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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