<commit_before>class GenerateTsvs < ActiveJob::Base
  def perform
    ensure_downloads_directory_exists
    tsvs_to_generate.each do |e|
      begin
        tmp_file = tmp_file(e.file_name)
        tmp_file.puts(e.headers.join("\t"))
        e.objects.find_each do |object|
          tmp_file.puts(e.row_from_object(object).join("\t"))
        end
        tmp_file.close
        FileUtils.cp(tmp_file.path, public_file_path(e.file_name))
      ensure
        tmp_file.unlink
      end
    end
  end<commit_msg>Ensure correct permissions on monthly TSV dumps<commit_after>class GenerateTsvs < ActiveJob::Base
  def perform
    ensure_downloads_directory_exists
    tsvs_to_generate.each do |e|
      begin
        tmp_file = tmp_file(e.file_name)
        tmp_file.puts(e.headers.join("\t"))
        e.objects.find_each do |object|
          tmp_file.puts(e.row_from_object(object).join("\t"))
        end
        tmp_file.close
        public_path = public_file_path(e.file_name)
        FileUtils.cp(tmp_file.path, public_path)
        File.chmod(0644, public_path)
      ensure
        tmp_file.unlink
      end
    end
  end
{'fraction_non_alphanumeric': 0.09147424511545293, 'fraction_numerical': 0.003552397868561279, 'mean_word_length': 2.555205047318612, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '324801', 'n_tokens_mistral': 384, 'n_tokens_neox': 378, 'n_words': 61}