Skip to content

Instantly share code, notes, and snippets.

@nooperpudd
Last active January 7, 2018 09:34
Show Gist options
  • Save nooperpudd/a7cbc9d8702a22d0acb7f9e8f3981f37 to your computer and use it in GitHub Desktop.
Save nooperpudd/a7cbc9d8702a22d0acb7f9e8f3981f37 to your computer and use it in GitHub Desktop.
load function
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