original_docstring: 
      Converts a directory of osis files to usfm
      :param in_dir:
      :param out_dir:
      :param lexicon:
      :return:
      
docstring: Converts a directory of osis files to usfm
docstring_tokens: Converts a directory of osis files to usfm
code: def convertDir(in_dir, out_dir, lexicon):
      """
      Converts a directory of osis files to usfm
      :param in_dir:
      :param out_dir:
      :param lexicon:
      :return:
      """
      logger = logging.getLogger(LOGGER_NAME)
  
      if os.path.isfile(in_dir):
          raise Exception('Input must be a directory')
      input_files = []
      for root, dirs, files in os.walk(in_dir):
          input_files.extend(files)
          break
  
      for file_name in input_files:
          if file_name.lower() == 'versemap.xml' or (not file_name.endswith('.xml') and not file_name.endswith('.osis')):
              print('Skipping file {}'.format(file_name))
              continue
          print('Processing {}...'.format(file_name))
          usfm = convertFile(os.path.join(in_dir, file_name), lexicon)
          book_id = os.path.splitext(file_name)[0]
          book_meta = get_book_by_osis_id(book_id)
          if book_meta:
              out_file = os.path.join(out_dir, '{}-{}.usfm'.format(book_meta['sort'], book_meta['usfm_id']))
              write_file(out_file, usfm)
          else:
              message = 'Missing book meta data for {}'.format(book_id)
              print(message)
              logger.error(message)
code_tokens: def convertDir ( in_dir , out_dir , lexicon ) : logger = logging . getLogger ( LOGGER_NAME ) if os . path . isfile ( in_dir ) : raise Exception ( 'Input must be a directory' ) input_files = [ ] for root , dirs , files in os . walk ( in_dir ) : input_files . extend ( files ) break for file_name in input_files : if file_name . lower ( ) == 'versemap.xml' or ( not file_name . endswith ( '.xml' ) and not file_name . endswith ( '.osis' ) ) : print ( 'Skipping file {}' . format ( file_name ) ) continue print ( 'Processing {}...' . format ( file_name ) ) usfm = convertFile ( os . path . join ( in_dir , file_name ) , lexicon ) book_id = os . path . splitext ( file_name ) [ 0 ] book_meta = get_book_by_osis_id ( book_id ) if book_meta : out_file = os . path . join ( out_dir , '{}-{}.usfm' . format ( book_meta [ 'sort' ] , book_meta [ 'usfm_id' ] ) ) write_file ( out_file , usfm ) else : message = 'Missing book meta data for {}' . format ( book_id ) print ( message ) logger . error ( message )
short_docstring: Converts a directory of osis files to usfm
short_docstring_tokens: Converts a directory of osis files to usfm
comment: """
      Converts a directory of osis files to usfm
      :param in_dir:
      :param out_dir:
      :param lexicon:
      :return:
      """