<commit_before>require 'docker'
require 'peach'
require 'spurious/server'
require 'excon'

module Spurious
  module Server
    module State
      class Base
        attr_accessor :connection, :config

        def initialize(connection, config)
          @connection      = connection
          @config          = config
          connection_timeouts
        end

        def connection_timeouts(connect = 1, read = 5, write = 5)
          Excon.defaults[:write_timeout]   = write
          Excon.defaults[:read_timeout]    = read
          Excon.defaults[:connect_timeout] = connect
        end

        def execute!
          raise NotImplementedError("You must implement execute!")
        end

        protected

        def spurious_containers
          Docker::Container.all(:all => true).select do |container|
            config.name_exists?(sanitize(container.json["Name"]))
          end.sort do |e1, e2|
            app_config.keys.index(sanitize(e1.json["Name"])) <=> app_config.keys.index(sanitize(e2.json["Name"]))
          end
        end

        def app_config
          config.app<commit_msg>Don't verifiy the CA for docker host<commit_after>require 'docker'
require 'peach'
require 'spurious/server'
require 'excon'

module Spurious
  module Server
    module State
      class Base
        attr_accessor :connection, :config

        def initialize(connection, config)
          @connection      = connection
          @config          = config
          connection_timeouts
        end

        def connection_timeouts(connect = 1, read = 5, write = 5)
          Excon.defaults[:write_timeout]   = write
          Excon.defaults[:read_timeout]    = read
          Excon.defaults[:connect_timeout] = connect
          Excon.defaults[:ssl_verify_peer] = false
        end

        def execute!
          raise NotImplementedError("You must implement execute!")
        end

        protected

        def spurious_containers
          Docker::Container.all(:all => true).select do |container|
            config.name_exists?(sanitize(container.json["Name"]))
          end.sort do |e1, e2|
            app_config.keys.index(sanitize(e1.json["Name"])) <=> app_config.keys.index(sanitize(e2.json["Name"]))
          end
        end

        def app_config
          config.app
{'fraction_non_alphanumeric': 0.09162303664921466, 'fraction_numerical': 0.006108202443280977, 'mean_word_length': 2.1454046639231823, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, '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': '3931636', 'n_tokens_mistral': 641, 'n_tokens_neox': 624, 'n_words': 145}