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
import os | |
def import_all_from(module_name, globals_): | |
# Calling it with the globals_ module provides a hook into the | |
# module-level globals; otherwise we'd get the function's globals | |
# (which might be different). | |
module_split = module_name.split('.') | |
while '__init__' in module_split: | |
module_split.remove('__init__') | |
while '__main__' in module_split: |