I'm writing a script that will walk through various Python modules, and hunt for instances of calls to fx.bind(). The first argument to this function is a string representing the hotkey, and the second argument is a function that will be run when the hotkey is pressed. For example, fx.bind('o', my_func)
.
I have created a subclass of ast.NodeVisitor, that implements visit_Call(), to check all Call nodes. What I'm wondering is how I can parse an actually instance of the callable that's passed as the second argument?
The idea being I can then store my own dictionary, where the keys are the functions, and values are the hotkeys they're assigned too. Ie.{<function my_func at 0x0>: 'o'}
Any help would be much appreciated!