<commit_before>require 'socket'
require 'tempfile'

module Appserver
  module Utils

    class << self
      def find_in_path (name)
        ENV['PATH'].split(':').find { |path| File.exist?(File.join(path, name)) }
      end

      def system_hostname
        Socket.gethostname
      end

      def system_domainname
        system_hostname.sub(/^[^.]+\./, '')
      end

      def number_of_cpus
        if File.exist?('/proc/cpuinfo')
          File.readlines('/proc/cpuinfo').grep(/^processor\s+:\s+\d+/).size
        end
      end

      def safe_replace_file (filename)
        tempfile = Tempfile.new(File.basename(filename) + '.', File.dirname(filename))
        if File.exist?(filename)
          tempfile.chown(File.stat(filename).uid, File.stat(filename).gid)
          tempfile.chmod(File.stat(filename).mode)
        end
        yield tempfile
        tempfile.close
        File.unlink(filename) if File.exist?(filename)
        File.rename(tempfile.path, filename)
      end

      def symbolize_keys (hash)
        hash.inject({}) do |memo, (key, value)|
          value = symbolize_keys(value) if Hash === value
          memo[key.to_sym] = value
          memo
        end
      end
    end
  end
end<commit_msg>Removed symbolize_keys<commit_after>require 'socket'
require 'tempfile'

module Appserver
  module Utils

    class << self
      def find_in_path (name)
        ENV['PATH'].split(':').find { |path| File.exist?(File.join(path, name)) }
      end

      def system_hostname
        Socket.gethostname
      end

      def system_domainname
        system_hostname.sub(/^[^.]+\./, '')
      end

      def number_of_cpus
        if File.exist?('/proc/cpuinfo')
          File.readlines('/proc/cpuinfo').grep(/^processor\s+:\s+\d+/).size
        end
      end

      def safe_replace_file (filename)
        tempfile = Tempfile.new(File.basename(filename) + '.', File.dirname(filename))
        if File.exist?(filename)
          tempfile.chown(File.stat(filename).uid, File.stat(filename).gid)
          tempfile.chmod(File.stat(filename).mode)
        end
        yield tempfile
        tempfile.close
        File.unlink(filename) if File.exist?(filename)
        File.rename(tempfile.path, filename)
      end
    end
  end
end
{'fraction_non_alphanumeric': 0.12798937112488928, 'fraction_numerical': 0.0, 'mean_word_length': 2.217948717948718, 'pattern_counts': {'":': 0, '<': 7, '<?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': '883454', 'n_tokens_mistral': 710, 'n_tokens_neox': 706, 'n_words': 132}