<commit_before>require 'veewee/builder/core/box'
require 'veewee/builder/core/box/vnc'

module Veewee
  module Builder
    module Kvm
      class Box < Veewee::Builder::Core::Box
        
        include ::Veewee::Builder::Core
        include ::Veewee::Builder::Kvm
        
        include ::Veewee::Builder::Core::BoxCommand
        
        attr_accessor :connection

        def initialize(name,env)

          require 'libvirt'
          require 'fog'

          super(name,env)
          
          @connection=::Fog::Compute.new(:provider => "Libvirt", 
          :libvirt_uri => "qemu:///system",
          :libvirt_ip_command => "arp -an |grep $mac|cut -d '(' -f 2 | cut -d ')' -f 1")
          
        end
        
        # Type on the console
        def console_type(sequence,type_options={})
                  vnc_port=@connection.servers.all(:name => name).first.vnc_port
                  display_port=vnc_port.to_i - 5900
                  vnc_type(sequence,"localhost",display_port)
        end
                
        
        # Create a new vm
        def create(definition)
          # Assemble the Virtualmachine and set all the memory and other stuff"

          #memory_size,cpu_count, volume_size

          s=@connection.servers.create(
            :name => name,
            :memory_size => definition.memory_size.to_i*1024,
            :cpus => definition.cpu_count.to_i,
            :volume_capacity => "#{definition.disk_size}M",
            :network_interface_type => "nat",
            :iso_file => definition.iso_file,
            :arch => definition.os_type_id.end_with?("_64") ? "x86_64" : "i686"
            :iso_dir => env.config.veewee.iso_dir,
            )
        end
        
        # Create the volume of a new vm
        def create_volume
          # Creating the volume is part of the server creation
        end
        
        # Destroy a vm
        def destroy
          halt if running?
          destroy_vm if exists_vm?
          
          vol_exists=!@connection.volumes.all(:name => "#{name}.img").nil?
          env.logger.info "Volume exists? : #{vol_exists}"
          destroy_volume if exists_volume?
        end
        
        def destroy_vm
          matched_servers=@connection.servers.all(:name => name)
          matched_servers.first.destroy() unless matched_servers.nil?
        end
<commit_msg>fixed missing comma<commit_after>require 'veewee/builder/core/box'
require 'veewee/builder/core/box/vnc'

module Veewee
  module Builder
    module Kvm
      class Box < Veewee::Builder::Core::Box
        
        include ::Veewee::Builder::Core
        include ::Veewee::Builder::Kvm
        
        include ::Veewee::Builder::Core::BoxCommand
        
        attr_accessor :connection

        def initialize(name,env)

          require 'libvirt'
          require 'fog'

          super(name,env)
          
          @connection=::Fog::Compute.new(:provider => "Libvirt", 
          :libvirt_uri => "qemu:///system",
          :libvirt_ip_command => "arp -an |grep $mac|cut -d '(' -f 2 | cut -d ')' -f 1")
          
        end
        
        # Type on the console
        def console_type(sequence,type_options={})
                  vnc_port=@connection.servers.all(:name => name).first.vnc_port
                  display_port=vnc_port.to_i - 5900
                  vnc_type(sequence,"localhost",display_port)
        end
                
        
        # Create a new vm
        def create(definition)
          # Assemble the Virtualmachine and set all the memory and other stuff"

          #memory_size,cpu_count, volume_size

          s=@connection.servers.create(
            :name => name,
            :memory_size => definition.memory_size.to_i*1024,
            :cpus => definition.cpu_count.to_i,
            :volume_capacity => "#{definition.disk_size}M",
            :network_interface_type => "nat",
            :iso_file => definition.iso_file,
            :arch => definition.os_type_id.end_with?("_64") ? "x86_64" : "i686",
            :iso_dir => env.config.veewee.iso_dir
            )
        end
        
        # Create the volume of a new vm
        def create_volume
          # Creating the volume is part of the server creation
        end
        
        # Destroy a vm
        def destroy
          halt if running?
          destroy_vm if exists_vm?
          
          vol_exists=!@connection.volumes.all(:name => "#{name}.img").nil?
          env.logger.info "Volume exists? : #{vol_exists}"
          destroy_volume if exists_volume?
        end
        
        def destroy_vm
          matched_servers=@connection.servers.all(:name => name)
          matched_servers.first.destroy() unless matched_servers.nil?
        end

{'fraction_non_alphanumeric': 0.10421940928270042, 'fraction_numerical': 0.008016877637130802, 'mean_word_length': 1.777387229056825, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 31, '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': '2735854', 'n_tokens_mistral': 1409, 'n_tokens_neox': 1375, 'n_words': 290}