<commit_before># Backup Model
#
# A backup model is a subclass of an Attachment. The attached file is a zip file
# containing the data and schema. The first actually is a YAML file
# that contains all the database records. It also includes the schema.rb to
# allow restoring backups on newer versions.
class Backup < Attachment
  alias tenant object

  # Dump data to file
  #
  # We use YAML to dump data to a file.
  def self.dump_data(temp)
    temp.binmode

    old_level = ActiveRecord::Base.logger.level
    ActiveRecord::Base.logger.level = 2 # don't log debug or info

    old_date_format = Date::DATE_FORMATS[:default]
    Date::DATE_FORMATS[:default] = '%Y-%m-%d'

    YamlDb::Helper.dumper.dump(temp)

    Date::DATE_FORMATS[:default] = old_date_format<commit_msg>Add require zip to Backup Model.<commit_after># Backup Model
#
# A backup model is a subclass of an Attachment. The attached file is a zip file
# containing the data and schema. The first actually is a YAML file
# that contains all the database records. It also includes the schema.rb to
# allow restoring backups on newer versions.
class Backup < Attachment
  alias tenant object

  require "zip"

  # Dump data to file
  #
  # We use YAML to dump data to a file.
  def self.dump_data(temp)
    temp.binmode

    old_level = ActiveRecord::Base.logger.level
    ActiveRecord::Base.logger.level = 2 # don't log debug or info

    old_date_format = Date::DATE_FORMATS[:default]
    Date::DATE_FORMATS[:default] = '%Y-%m-%d'

    YamlDb::Helper.dumper.dump(temp)

    Date::DATE_FORMATS[:default] = old_date_format
{'fraction_non_alphanumeric': 0.08511979823455233, 'fraction_numerical': 0.0012610340479192938, 'mean_word_length': 3.7801204819277108, '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': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2806979', 'n_tokens_mistral': 500, 'n_tokens_neox': 476, 'n_words': 180}