Skip to content

Instantly share code, notes, and snippets.

Avatar

Dan Reif CH-DanReif

View GitHub Profile
@CH-DanReif
CH-DanReif / wtaf.py
Last active Mar 6, 2019
WTAF: Try to grok an arbitrary Python object, as well as one reasonably can. N.b. it tries to call the methods. You own anything you break.
View wtaf.py
import types
from typing import Callable, Dict
def _funcify(obj: object, key: str, hist: Dict) -> str:
"""
Call {obj}.{key}() if possible.
@param hist: A dict that starts empty when we begin enumerating an object.
If this method would otherwise recurse, even in a loop, don't.
You can’t perform that action at this time.