<commit_before>#Load Cleo Sub Modules

require File.dirname(__FILE__) + '/base_server'
require File.dirname(__FILE__) + '/connection_server'
require File.dirname(__FILE__) + '/element_server'
require File.dirname(__FILE__) + '/service'
require File.dirname(__FILE__) + '/element'

require 'resque'


module Cleo
  def self.query(query)
    Cleo::ElementServer.query(query)
  end

  def self.network_query(source_id, query)
  end

  def self.net_http
    uri = URI.parse(Cleo::Service.url)
    Net::HTTP.new(uri.host, uri.port)
  end

  def self.get(uri)
    response = net_http.request(Net::HTTP::Get.new(uri.request_uri))

    return response if Cleo::Service.good_response_code?(response)
  end

  def self.flush
    Cleo.flush_elements
    Cleo.flush_connections
  end

  def self.flush_connections
    uri = URI.parse Cleo::Service.connection_server_url + "/flush"
    request = Net::HTTP::Post.new(uri.path)
    Net::HTTP.new(uri.host, uri.port).start { |http| http.request request }
  end

  def self.flush_elements
    uri = URI.parse Cleo::Service.element_server_url + "/flush"
    request = Net::HTTP::Post.new(uri.path)
    Net::HTTP.new(uri.host, uri.port).start { |http| http.request request }
  end
<commit_msg>Fix for flushes<commit_after>#Load Cleo Sub Modules

require File.dirname(__FILE__) + '/base_server'
require File.dirname(__FILE__) + '/connection_server'
require File.dirname(__FILE__) + '/element_server'
require File.dirname(__FILE__) + '/service'
require File.dirname(__FILE__) + '/element'

require 'resque'


module Cleo
  def self.query(query)
    Cleo::ElementServer.query(query)
  end

  def self.network_query(source_id, query)
  end

  def self.net_http
    uri = URI.parse(Cleo::Service.url)
    Net::HTTP.new(uri.host, uri.port)
  end

  def self.get(uri)
    response = net_http.request(Net::HTTP::Get.new(uri.request_uri))

    return response if Cleo::Service.good_response_code?(response)
  end

  def self.flush
    Cleo.flush_elements and Cleo.flush_connections
  end

  def self.flush_connections
    uri = URI.parse Cleo::Service.connection_server_url + "flush"
    request = Net::HTTP::Post.new(uri.path)
    response = Net::HTTP.new(uri.host, uri.port).start { |http| http.request request }
    Cleo::Service.good_response_code?(response)
  end

  def self.flush_elements
    uri = URI.parse Cleo::Service.element_server_url + "flush"
    request = Net::HTTP::Post.new(uri.path)
    response = Net::HTTP.new(uri.host, uri.port).start { |http| http.request request }
    Cleo::Service.good_response_code?(response)
  end

{'fraction_non_alphanumeric': 0.12860483242400625, 'fraction_numerical': 0.0, 'mean_word_length': 4.260245901639344, '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': '4499853', 'n_tokens_mistral': 871, 'n_tokens_neox': 852, 'n_words': 167}