<commit_before>module Fog
  module Compute
    class Tenderfusion
      class Real

        def vm_ip(vmx)
          ip = get_guest_var(vmx, 'ip')
          if ip && ip.strip =~ /^(?:[0-9]{1,3}\.){3}[0-9]{1,3}$/
            ip = ip.strip
          else
            mac_address = VMXFile.load(vmx)["ethernet0.generatedAddress"]
            ip = dhcp_leases[mac_address]
          end
          ip
        end

        private

        def get_guest_var(vmx, var)
          vmrun 'readVariable', 'guestVar ' + var, :vmx => vmx
        end

        def dhcp_leases
          mac_ip = {}
          curLeaseIp = nil
          Dir['/var/db/vmware/vmnet-dhcpd*.leases'].each do |f|
            File.open(f).each do |line|
              case line
              when /lease (.*) \{/
                curLeaseIp = $1
              when /hardware ethernet (.*);/
                mac_ip[$1] = curLeaseIp
              end
            end
          end
          mac_ip
        end

      end
    end
  end
end
<commit_msg>Pass opts correctly.<commit_after>module Fog
  module Compute
    class Tenderfusion
      class Real

        def vm_ip(vmx)
          ip = get_guest_var(vmx, 'ip')
          if ip && ip.strip =~ /^(?:[0-9]{1,3}\.){3}[0-9]{1,3}$/
            ip = ip.strip
          else
            mac_address = VMXFile.load(vmx)["ethernet0.generatedAddress"]
            ip = dhcp_leases[mac_address]
          end
          ip
        end

        private

        def get_guest_var(vmx, var)
          vmrun 'readVariable', :opts => 'guestVar ' + var, :vmx => vmx
        end

        def dhcp_leases
          mac_ip = {}
          curLeaseIp = nil
          Dir['/var/db/vmware/vmnet-dhcpd*.leases'].each do |f|
            File.open(f).each do |line|
              case line
              when /lease (.*) \{/
                curLeaseIp = $1
              when /hardware ethernet (.*);/
                mac_ip[$1] = curLeaseIp
              end
            end
          end
          mac_ip
        end

      end
    end
  end
end

{'fraction_non_alphanumeric': 0.11209439528023599, 'fraction_numerical': 0.011799410029498525, 'mean_word_length': 1.2216157205240175, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 6, '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': '969684', 'n_tokens_mistral': 682, 'n_tokens_neox': 655, 'n_words': 141}