def generate_targets(target_source):
 target_source = os.path.abspath(target_source)
 if os.path.isdir(target_source):
  target_source_files = glob.glob((target_source + '/*.tsv'))
 else:
  target_source_files = [target_source]
 for target_source_file in target_source_files:
  with open(target_source_file, 'r') as f:
   for line in f.readlines():
    if line:
     line = line.strip()
    if ((not line) or line.startswith('#')):
     continue
    (yield line_to_targets(line))

def generate_targets ( target_source ) : target_source = os . path . abspath ( target_source ) if os . path . isdir ( target_source ) : target_source_files = glob . glob ( ( target_source + '/*.tsv' ) ) else : target_source_files = [ target_source ] for target_source_file in target_source_files : with open ( target_source_file , 'r' ) as f : for line in f . readlines ( ) : if line : line = line . strip ( ) if ( ( not line ) or line . startswith ( '#' ) ) : continue ( yield line_to_targets ( line ) )
generate all targets from tsv files in specified file or directory .