Last active
January 7, 2018 09:34
-
-
Save nooperpudd/a7cbc9d8702a22d0acb7f9e8f3981f37 to your computer and use it in GitHub Desktop.
load function
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 importlib | |
import inspect | |
from functools import lru_cache | |
@lru_cache(maxsize=10240) | |
def loads_requests(): | |
commands = {} | |
modules_data = inspect.getmembers(importlib.import_module(__name__)) | |
for func_name, func in modules_data: | |
if inspect.isfunction(func) and func_name.startswith("On"): | |
commands[func_name] = func | |
return commands |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment