def load_sous_chefs(): """ Get all internal and user-specified sous chef configurations. """ # internal sous chefs for fp in recursive_listdir(SOUS_CHEF_DIR): if _is_config_file(fp): yield load_sous_chef(fp) # user-generated sous-chefs. if hasattr(settings, 'SOUS_CHEFS_DIR'): sous_chef_dir = settings.SOUS_CHEFS_DIR if sous_chef_dir.startswith('~'): sous_chef_dir = \ os.path.expanduser(sous_chef_dir) if not os.path.exists(sous_chef_dir): raise ConfigError( "'{}' was explicitly declared as " "the sous_chef_dir but could " "not be found." .format(sous_chef_dir) ) else: sous_chef_dir = os.path.expanduser( '~/.newslynx/sous-chefs/') if os.path.exists(sous_chef_dir): for fp in recursive_listdir(sous_chef_dir): if _is_config_file(fp): yield load_sous_chef(fp)
def load_sous_chefs(): """ Get all internal and user-specified sous chef configurations. """ # internal sous chefs for fp in recursive_listdir(SOUS_CHEF_DIR): if _is_config_file(fp): yield load_sous_chef(fp) # user-generated sous-chefs. if hasattr(settings, 'SOUS_CHEFS_DIR'): sous_chef_dir = settings.SOUS_CHEFS_DIR if sous_chef_dir.startswith('~'): sous_chef_dir = \ os.path.expanduser(sous_chef_dir) if not os.path.exists(sous_chef_dir): raise ConfigError("'{}' was explicitly declared as " "the sous_chef_dir but could " "not be found.".format(sous_chef_dir)) else: sous_chef_dir = os.path.expanduser('~/.newslynx/sous-chefs/') if os.path.exists(sous_chef_dir): for fp in recursive_listdir(sous_chef_dir): if _is_config_file(fp): yield load_sous_chef(fp)
def load_sql(): """ Get all sql files. """ for fp in sorted(list(recursive_listdir(SQL_DIR))): if fp.endswith('sql'): yield open(fp).read()
def findsc(sous_chef_dir): # internal sous chefs if incl_internal: for fp in recursive_listdir(SOUS_CHEF_DIR): if _is_config_file(fp): sc = sous_chef_schema.load(fp) if 'slug' in sc: yield sc, fp # sous chef modules. if os.path.exists(sous_chef_dir): for fp in recursive_listdir(sous_chef_dir): if _is_config_file(fp): sc = sous_chef_schema.load(fp) if 'slug' in sc: yield sc, fp