Created
August 13, 2016 05:51
-
-
Save thorsummoner/bf0142fd24974a0ced778768a33a3069 to your computer and use it in GitHub Desktop.
hell debugger
This file contains 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 | |
depth = 0 | |
def props(obj): | |
global depth | |
depth += 1 | |
pr = {} | |
for name in dir(obj): | |
try: | |
value = getattr(obj, name) | |
if not name.startswith('__') and not inspect.ismethod(value): | |
pr[name] = value | |
if value.__repr__().startswith('<') and depth < 5: | |
pr[name] = props(value) | |
except Exception as err: | |
print(err) | |
continue | |
depth -= 1 | |
return pr |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment