utils.py 394 B

1234567891011
  1. def import_module_symbols(globals_dict, module, exclude=None):
  2. """Import all public symbols from a module into globals."""
  3. if exclude is None:
  4. exclude = set()
  5. symbols = []
  6. for name in dir(module):
  7. if not name.startswith('_') and name not in exclude:
  8. globals_dict[name] = getattr(module, name)
  9. symbols.append(name)
  10. return symbols