can call custom functions from condition code while pattern matching / rewriting + added example to runner_translate.py
This commit is contained in:
parent
fd8bc3bc40
commit
9e74075066
5 changed files with 95 additions and 45 deletions
8
util/module_to_dict.py
Normal file
8
util/module_to_dict.py
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
# Based on: https://stackoverflow.com/a/46263657
|
||||
def module_to_dict(module):
|
||||
context = {}
|
||||
for name in dir(module):
|
||||
# this will filter out 'private' functions, as well as __builtins__, __name__, __package__, etc.:
|
||||
if not name.startswith('_'):
|
||||
context[name] = getattr(module, name)
|
||||
return context
|
||||
Loading…
Add table
Add a link
Reference in a new issue