<commit_before>class FileDepot < ActiveRecord::Base
  include NewWithTypeStiMixin
  include AuthenticationMixin
  belongs_to            :resource, :polymorphic => true
  has_many              :miq_servers, :foreign_key => :log_file_depot_id, :dependent => :nullify
  has_many              :log_files
  validates_presence_of :uri

  attr_accessor         :file

  def self.supported_depots
    @supported_depots ||= descendants.each_with_object({}) { |klass, hash| hash[klass.name] = Dictionary.gettext(klass.name, :type => :model, :notfound => :titleize) }.freeze
  end

  def self.requires_credentials?
    true
  end

  def requires_support_case?
    false
  end

  def depot_hash=(hsh = {})
    return if hsh == self.depot_hash
    self.update_authentication( {:default => {:userid => hsh[:username], :password => hsh[:password]} } )
    self.update_attribute(:uri, hsh[:uri])
  end

  def depot_hash
    { :username => self.authentication_userid,
      :uri      => self.uri,
      :password => <PASSWORD>.authentication_password
    }
  end

  def self.verify_depot_hash(hsh)
    return true unless MiqEnvironment::Command.is_appliance?

    # TODO: Move the logfile "depot" logic into remaining subclasses
    LogFile.verify_log_depot_settings(hsh)
  end

  def verify_credentials(_auth_type = nil)
    self.class.verify_depot_hash(self.depot_hash)
  end

  def upload_file(file)
    @file = file
  end
end
<commit_msg>FileDepot: Save depot name<commit_after>class FileDepot < ActiveRecord::Base
  include NewWithTypeStiMixin
  include AuthenticationMixin
  belongs_to            :resource, :polymorphic => true
  has_many              :miq_servers, :foreign_key => :log_file_depot_id, :dependent => :nullify
  has_many              :log_files
  validates_presence_of :uri

  attr_accessor         :file

  def self.supported_depots
    @supported_depots ||= descendants.each_with_object({}) { |klass, hash| hash[klass.name] = Dictionary.gettext(klass.name, :type => :model, :notfound => :titleize) }.freeze
  end

  def self.requires_credentials?
    true
  end

  def requires_support_case?
    false
  end

  def depot_hash=(hsh = {})
    return if hsh == depot_hash
    update_authentication(:default => {:userid   => hsh[:username],
                                       :password => hsh[:password]})
    update_attribute(:uri, hsh[:uri])
    update_attribute(:name, hsh[:name])
  end

  def depot_hash
    {:username => authentication_userid,
     :uri      => uri,
     :password => <PASSWORD>,
     :name     => name}
  end

  def self.verify_depot_hash(hsh)
    return true unless MiqEnvironment::Command.is_appliance?

    # TODO: Move the logfile "depot" logic into remaining subclasses
    LogFile.verify_log_depot_settings(hsh)
  end

  def verify_credentials(_auth_type = nil)
    self.class.verify_depot_hash(self.depot_hash)
  end

  def upload_file(file)
    @file = file
  end
end

{'fraction_non_alphanumeric': 0.1018582243633861, 'fraction_numerical': 0.0, 'mean_word_length': 3.3517964071856285, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 28, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2243060', 'n_tokens_mistral': 975, 'n_tokens_neox': 952, 'n_words': 200}