<commit_before>require 'file/kind'
require 'dir/each_leaf'
require 'fileutils'

module FileUtils
  class Sync
    def self.each_leaf(src, dst, flag=0, nf=false, block=nil)
      block = Proc.new if block_given?
      if [File.kind(src, nf), File.kind(dst, nf)].all?{|k| k == :directory}
        Dir.children(src, flag) do |file|
          target = File.join(dst, File.basename(file))
          self.each_leaf(file, target, flag, nf, block) # recursive
        end
      else
        block && block.call(src, dst)
      end
    end

    def self.conflict?(src, dst, nofollow=false)<commit_msg>No conflict when desitination doesn't exist.<commit_after>require 'file/kind'
require 'dir/each_leaf'
require 'fileutils'

module FileUtils
  class Sync
    def self.each_leaf(src, dst, flag=0, nf=false, block=nil)
      block = Proc.new if block_given?
      if [File.kind(src, nf), File.kind(dst, nf)].all?{|k| k == :directory}
        Dir.children(src, flag) do |file|
          target = File.join(dst, File.basename(file))
          self.each_leaf(file, target, flag, nf, block) # recursive
        end
      else
        block && block.call(src, dst)
      end
    end

    def self.conflict?(src, dst, nofollow=false)
      return false unless File.exist?(dst)
{'fraction_non_alphanumeric': 0.13036565977742448, 'fraction_numerical': 0.001589825119236884, 'mean_word_length': 2.909937888198758, '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': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5409581', 'n_tokens_mistral': 437, 'n_tokens_neox': 425, 'n_words': 110}