<s> """<STR_LIT>""" <EOL> import sys <EOL> import os <EOL> import glob <EOL> import imp <EOL> from collections import OrderedDict <EOL> from mod import log , util , dep <EOL> verbs = { } <EOL> proj_verbs = OrderedDict ( ) <EOL> def import_verbs_from ( proj_name , proj_dir , verb_dir ) : <EOL> """<STR_LIT>""" <EOL> global verbs , proj_verbs <EOL> if not proj_dir in sys . path : <EOL> sys . path . insert ( <NUM_LIT:0> , proj_dir ) <EOL> if os . path . isdir ( verb_dir ) : <EOL> verb_paths = glob . glob ( verb_dir + '<STR_LIT>' ) <EOL> if verb_paths : <EOL> for verb_path in verb_paths : <EOL> verb_module_name = os . path . split ( verb_path ) [ <NUM_LIT:1> ] <EOL> verb_module_name = os . path . splitext ( verb_module_name ) [ <NUM_LIT:0> ] <EOL> if not verb_module_name . startswith ( '<STR_LIT>' ) : <EOL> if not verb_module_name in verbs : <EOL> fp , pathname , desc = imp . find_module ( verb_module_name , [ verb_dir ] ) <EOL> verb_module = imp . load_module ( verb_module_name , fp , pathname , desc ) <EOL> verbs [ verb_module_name ] = verb_module <EOL> if proj_name not in proj_verbs : <EOL> proj_verbs [ proj_name ] = [ ] <EOL> proj_verbs [ proj_name ] . append ( verb_module_name ) <EOL> def import_verbs ( fips_dir , proj_dir ) : <EOL> """<STR_LIT>""" <EOL> import_verbs_from ( '<STR_LIT>' , fips_dir , fips_dir + '<STR_LIT>' ) <EOL> if fips_dir != proj_dir : <EOL> _ , imported_projs = dep . get_all_imports_exports ( fips_dir , proj_dir ) <EOL> for imported_proj_name in imported_projs : <EOL> imported_proj_dir = util . get_project_dir ( fips_dir , imported_proj_name ) <EOL> import_verbs_from ( imported_proj_name , imported_proj_dir , imported_proj_dir + '<STR_LIT>' ) </s>
