ianb
August 25, 2022, 4:14pm
7
you might be able to use dis
together with globals() to gather your module names, I’m not sure where it would take you but its definately a place to start.
I used it here:
If anyone is curious what it is doing, I am using the dis module to disassemble the functions instructions and pulling the name of every argument used into a set, and comparing it to the keys in the lazy dictionary. Then it executes the string of code as written in said dictionary, then registers the imported method as global so it can be used by whatever function it @decorated.
For anyone unfamiliar, here is an example of the information provided by dis (called on the wrapper function as writt…