Last active
September 27, 2018 04:01
-
-
Save marskar/28100f5cd3e0f4b56fc2c839627b4df3 to your computer and use it in GitHub Desktop.
This file contains 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
from importlib import import_module | |
def pydy(cls, src: str = 'helper'): | |
class Pydy(cls): | |
pass | |
mod = import_module(src) | |
internals = mod.__dict__.items() | |
method_names = [name for name, val in internals if callable(val)] | |
for name in method_names: | |
met = getattr(mod, name) | |
setattr(Pydy, name, met) | |
return Pydy |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment