<commit_before># hal - class Hal - Hardware Abstraction Layer - dispatches to file or VFS

class Hal
  class << self
    # simulate Dir[]
    def [] path
      if $in_virtual || virtual?(path)
        VirtualLayer[path]
      else
        PhysicalLayer[path]
      end
    end
    def pwd
      if $in_virtual
        VirtualLayer.pwd
      else
        PhysicalLayer.pwd
      end
    end
    def relative? path
      path[0] != '/'
    end

    def chdir path, current_pwd=self.pwd
      in_virtual = virtual?(current_pwd)
      if (self.relative?(path) && in_virtual) || self.virtual?(path)
        $in_virtual = true
        VirtualLayer.chdir path
      else
        $in_virtual = false
        PhysicalLayer.chdir path
      end
    end
    # is this virtual or is it real
    def virtual? path
      VirtualLayer.virtual? path
    end
    #def mkdir_p path
      #if virtual? path
        #VirtualLayer.mkdir_p path
      #else
        #PhysicalLayer.mkdir_p path
      #end
    #end
    # simulate File.open, directory?
    def open path, mode
      if virtual? path || $in_virtual
        VirtualLayer.open(path, mode)
      else
        PhysicalLayer.open path, mode
      end
    end
    #def directory? path
      #if virtual? path
        #VirtualLayer.directory? path
      #else
        #PhysicalLayer.directory? path
      #end
    #end
    def touch path
      if $in_virtual || virtual?(path)
        VirtualLayer.touch(path)
      else
        PhysicalLayer.touch path
      end
    end
    def basename path
      PhysicalLayer.basename path
    end
    def dirname path
      File.dirname path
    end
    #def realpath path
    #if virtual? path
      #VirtualLayer.realpath path
    #else
        #PhysicalLayer.realpath path
      #end
    #end
    #def cp src, dest
      #if virtual? src
        #VirtualLayer.cp src, dest
      #else
        #PhysicalLayer.cp src, dest
      #end
    #end
    #def mv src, dest
      #if virtual? src
        #VirtualLayer.mv(VirtualLayer.realpath(src), VirtualLayer.realpath(dest))
      #else
        #PhysicalLayer.mv src, dest
      #end
    #end
    #def rm path
            #if virtual? path
              #VirtualLayer.rm(VirtualLayer.realpath(path))
            #else
              #PhysicalLayer.rm path
            #end
    #end
    #def exist? path
            #if virtual? path
              #VirtualLayer.exist? path
            #else
        #PhysicalLayer.exist? path
      #end
    #end
    def _dispatch arg
      if virtual? arg
        VirtualLayer
      else
        PhysicalLayer
      end
    end
    def method_missing name, *args
      klass = _dispatch args[0]
      klass.send name, *args
    end
  end
end<commit_msg>\'completed refactor of Hal to move some methods to method_missing\'<commit_after># hal - class Hal - Hardware Abstraction Layer - dispatches to file or VFS

class Hal
  class << self
    # simulate Dir[]
    def [] path
      if $in_virtual || virtual?(path)
        VirtualLayer[path]
      else
        PhysicalLayer[path]
      end
    end
    def pwd
      if $in_virtual
        VirtualLayer.pwd
      else
        PhysicalLayer.pwd
      end
    end
    def relative? path
      path[0] != '/'
    end

    def chdir path, current_pwd=self.pwd
      in_virtual = virtual?(current_pwd)
      if (self.relative?(path) && in_virtual) || self.virtual?(path)
        $in_virtual = true
        VirtualLayer.chdir path
      else
        $in_virtual = false
        PhysicalLayer.chdir path
      end
    end
    # is this virtual or is it real
    def virtual? path
      VirtualLayer.virtual? path
    end

    # simulate File.open, directory?
    def open path, mode
      if virtual? path || $in_virtual
        VirtualLayer.open(path, mode)
      else
        PhysicalLayer.open path, mode
      end
    end

    def touch path
      if $in_virtual || virtual?(path)
        VirtualLayer.touch(path)
      else
        PhysicalLayer.touch path
      end
    end
    def basename path
      PhysicalLayer.basename path
    end
    def dirname path
      File.dirname path
    end

    def _dispatch arg
      if virtual? arg
        VirtualLayer
      else
        PhysicalLayer
      end
    end
    def method_missing name, *args
      klass = _dispatch args[0]
      klass.send name, *args
    end
  end
end
{'fraction_non_alphanumeric': 0.07013888888888889, 'fraction_numerical': 0.000925925925925926, 'mean_word_length': 1.7680973734785395, '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': '6568039', 'n_tokens_mistral': 1280, 'n_tokens_neox': 1270, 'n_words': 389}