<commit_before>require 'dbagile/core/repository/yaml_methods'
module DbAgile
  module Core
    class Repository
      include Enumerable
      extend Repository::YAMLClassMethods
      include Repository::YAMLInstanceMethods
    
      # Index file name
      REPOSITORY_INDEX_FILE_NAME = "dbagile.idx"
    
      # Path to the root path of the repository
      attr_reader :root_path
    
      # Repository version
      attr_accessor :version
      private :version=
    
      # Databases as an array of Database instances
      attr_reader :databases
    
      # Current database (its name, i.e. a Symbol)
      attr_accessor :current_db_name
    
      #############################################################################################
      ### Initialization and parsing
      #############################################################################################
    
      # Creates a repository instance
      def initialize(root_path, version = DbAgile::VERSION)
        DbAgile::Robustness::valid_rw_directory!(root_path)
        DbAgile::Robustness::valid_rw_file!(File.join(root_path, REPOSITORY_INDEX_FILE_NAME))
        @root_path = root_path
        @version = version
        @databases = []
      end
      
      #############################################################################################
      ### File management
      #############################################################################################
      
      # Returns a friendly path to be printed to user
      def friendly_path
        DbAgile::FileSystemTools::friendly_path!(root_path)
      end
      
      # Returns the path to the index file
      def index_file
        File.join(root_path, REPOSITORY_INDEX_FILE_NAME)
      end
    
      # Returns a file resolver Proc instance
      def file_resolver
        @file_resolver ||= lambda{|f| 
          if f[0, 1] == '/'
            f
          else
            ::File.join(self.root_path, f) 
          end
        }
      end
      
      # Resolves a file which could be relative to repository root path
      def resolve_file(f)
        file_resolve.call(f)
      end<commit_msg>Fixes a bug when using local sqlite databases.<commit_after>require 'dbagile/core/repository/yaml_methods'
module DbAgile
  module Core
    class Repository
      include Enumerable
      extend Repository::YAMLClassMethods
      include Repository::YAMLInstanceMethods
    
      # Index file name
      REPOSITORY_INDEX_FILE_NAME = "dbagile.idx"
    
      # Path to the root path of the repository
      attr_reader :root_path
    
      # Repository version
      attr_accessor :version
      private :version=
    
      # Databases as an array of Database instances
      attr_reader :databases
    
      # Current database (its name, i.e. a Symbol)
      attr_accessor :current_db_name
    
      #############################################################################################
      ### Initialization and parsing
      #############################################################################################
    
      # Creates a repository instance
      def initialize(root_path, version = DbAgile::VERSION)
        DbAgile::Robustness::valid_rw_directory!(root_path)
        DbAgile::Robustness::valid_rw_file!(File.join(root_path, REPOSITORY_INDEX_FILE_NAME))
        @root_path = root_path
        @version = version
        @databases = []
      end
      
      #############################################################################################
      ### File management
      #############################################################################################
      
      # Returns a friendly path to be printed to user
      def friendly_path
        DbAgile::FileSystemTools::friendly_path!(root_path)
      end
      
      # Returns the path to the index file
      def index_file
        File.join(root_path, REPOSITORY_INDEX_FILE_NAME)
      end
    
      # Returns a file resolver Proc instance
      def file_resolver
        @file_resolver ||= lambda{|f| 
          if f[0, 1] == '/'
            f
          else
            ::File.join(File.expand_path(self.root_path), f) 
          end
        }
      end
      
      # Resolves a file which could be relative to repository root path
      def resolve_file(f)
        file_resolve.call(f)
      end
{'fraction_non_alphanumeric': 0.22227283079025278, 'fraction_numerical': 0.0009109542245502164, 'mean_word_length': 2.684563758389262, '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': '4015274', 'n_tokens_mistral': 1131, 'n_tokens_neox': 1076, 'n_words': 274}