<commit_before>require 'drb'

module RR

  # This class represents a rubyrep session.
  # Creates and holds expensive objects like e. g. database connections.
  class Session
    
    # Deep copy of the original Configuration object
    attr_accessor :configuration
    
    # Returns the "left" ActiveRecord / proxy database connection
    def left
      @connections[:left]
    end
    
    # Stores the "left" ActiveRecord /proxy database connection
    def left=(connection)
      @connections[:left] = connection
    end
    
    # Returns the "right" ActiveRecord / proxy database connection
    def right
      @connections[:right]
    end
    
    # Stores the "right" ActiveRecord / proxy database connection
    def right=(connection)
      @connections[:right] = connection
    end
    
    # Does the actual work of establishing a database connection
    # db_arm:: should be either :left or :right
    # arm_config:: hash of database connection parameters
    def db_connect(db_arm, arm_config)
      @connections[db_arm] = ConnectionExtenders.db_connect arm_config
    end
    private :db_connect
    
    # Does the actual work of establishing a proxy connection
    # db_arm:: should be either :left or :right
    # arm_config:: hash of proxy connection parameters
    def proxy_connect(db_arm, arm_config)
      if arm_config.include? :proxy_host 
        drb_url = "druby://#{arm_config[:proxy_host]}:#{arm_config[:proxy_port]}"
        @connections[db_arm] = DRbObject.new nil, drb_url
      else
        # If one connection goes through a proxy, so has the next one.
        # So if necessary, create a "fake" proxy
        @connections[db_arm] = DatabaseProxy.new
      end
    end
    private :proxy_connect
    
    # True if proxy connections are used
    def proxied?
      [configuration.left, configuration.right].any? \<commit_msg>Removed private declaration for Session#db_connect and Session#proxy_connect<commit_after>require 'drb'

module RR

  # This class represents a rubyrep session.
  # Creates and holds expensive objects like e. g. database connections.
  class Session
    
    # Deep copy of the original Configuration object
    attr_accessor :configuration
    
    # Returns the "left" ActiveRecord / proxy database connection
    def left
      @connections[:left]
    end
    
    # Stores the "left" ActiveRecord /proxy database connection
    def left=(connection)
      @connections[:left] = connection
    end
    
    # Returns the "right" ActiveRecord / proxy database connection
    def right
      @connections[:right]
    end
    
    # Stores the "right" ActiveRecord / proxy database connection
    def right=(connection)
      @connections[:right] = connection
    end
    
    # Does the actual work of establishing a database connection
    # db_arm:: should be either :left or :right
    # arm_config:: hash of database connection parameters
    def db_connect(db_arm, arm_config)
      @connections[db_arm] = ConnectionExtenders.db_connect arm_config
    end
    
    # Does the actual work of establishing a proxy connection
    # db_arm:: should be either :left or :right
    # arm_config:: hash of proxy connection parameters
    def proxy_connect(db_arm, arm_config)
      if arm_config.include? :proxy_host 
        drb_url = "druby://#{arm_config[:proxy_host]}:#{arm_config[:proxy_port]}"
        @connections[db_arm] = DRbObject.new nil, drb_url
      else
        # If one connection goes through a proxy, so has the next one.
        # So if necessary, create a "fake" proxy
        @connections[db_arm] = DatabaseProxy.new
      end
    end
    
    # True if proxy connections are used
    def proxied?
      [configuration.left, configuration.right].any? \
{'fraction_non_alphanumeric': 0.07184986595174263, 'fraction_numerical': 0.0, 'mean_word_length': 2.9315068493150687, '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': '5358403', 'n_tokens_mistral': 1024, 'n_tokens_neox': 998, 'n_words': 358}