<commit_before>#!/usr/bin/env ruby
require 'fileutils'
require 'find'

module Directory
	DERIVED_DATA_DIRECTORY = "#{File.expand_path('~')}/Library/Developer/Xcode/DerivedData/*"
	ARCHIVES_DIRECTORY = "#{File.expand_path('~')}/Library/Developer/Xcode/Archives/*"
end

def dir_size(dir_path)
  total_size = 0
  Find.find(dir_path) do |path|
      if FileTest.directory?(path)
        if File.basename(path)[0] == ?.
          Find.prune
        else
          next
        end
      else
        total_size += FileTest.size(path)
      end
    end
    total_size
end

trash_size = 0
Directory.constants.each do |dir|
	trash_dir = Directory.const_get(dir)
	files = Dir.glob(trash_dir)
	if files.empty?
		puts "There are no files in #{dir}"
		next
	end
	puts "#{dir} files:"
	files.each do |folder|
		trash_size += dir_size(folder)
		puts File.basename(folder)
		FileUtils.rm_rf(folder)
	end
	puts "Deleted all files from #{dir}"
end
puts "\n#{trash_size} bytes deleted"<commit_msg>Removes unnecessary logs and changes Module name<commit_after>#!/usr/bin/env ruby
require 'fileutils'
require 'find'

module XcodeDirectories
	DERIVED_DATA = "#{File.expand_path('~')}/Library/Developer/Xcode/DerivedData/*"
	ARCHIVES = "#{File.expand_path('~')}/Library/Developer/Xcode/Archives/*"
end

def dir_size(dir_path)
  total_size = 0
  Find.find(dir_path) do |path|
      if FileTest.directory?(path)
        if File.basename(path)[0] == ?.
          Find.prune
        else
          next
        end
      else
        total_size += FileTest.size(path)
      end
    end
    total_size
end

trash_size = 0
XcodeDirectories.constants.each do |dir|
	files = Dir.glob(XcodeDirectories.const_get(dir))
	if files.empty?
		next
	end
	files.each do |folder|
		trash_size += dir_size(folder)
		FileUtils.rm_rf(folder)
	end
end
puts "Deleted all files from #{XcodeDirectories.constants[0]} and #{XcodeDirectories.constants[1]}"
puts "\n#{trash_size} bytes deleted"
{'fraction_non_alphanumeric': 0.12551440329218108, 'fraction_numerical': 0.00411522633744856, 'mean_word_length': 3.502314814814815, 'pattern_counts': {'":': 0, '<': 3, '<?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': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5250208', 'n_tokens_mistral': 721, 'n_tokens_neox': 706, 'n_words': 149}