<commit_before>module Vagrant
  module Command
    module Helpers
      # Initializes the environment by pulling the environment out of
      # the configuration hash and sets up the UI if necessary.
      def initialize_environment(args, options, config)
        raise Errors::CLIMissingEnvironment.new if !config[:env]
        @env = config[:env]
        @env.ui = UI::Shell.new(@env, shell) if !@env.ui.is_a?(UI::Shell)
      end

      # This returns an array of {VM} objects depending on the arguments
      # given to the command.
      def target_vms(name=nil)
        name ||= self.name

        @target_vms ||= begin
          if env.multivm?
            return env.vms.values if !name
            vm = env.vms[name.to_sym]
            raise Errors::VMNotFoundError.new(:name => name) if !vm
          else
            raise Errors::MultiVMEnvironmentRequired.new if name
            vm = env.vms.values.first
          end

          [vm]
        end
      end
    end
  end
end<commit_msg>"self.name" needn't be defined for target_vms helper to be used<commit_after>module Vagrant
  module Command
    module Helpers
      # Initializes the environment by pulling the environment out of
      # the configuration hash and sets up the UI if necessary.
      def initialize_environment(args, options, config)
        raise Errors::CLIMissingEnvironment.new if !config[:env]
        @env = config[:env]
        @env.ui = UI::Shell.new(@env, shell) if !@env.ui.is_a?(UI::Shell)
      end

      # This returns an array of {VM} objects depending on the arguments
      # given to the command.
      def target_vms(name=nil)
        name ||= self.name rescue nil

        @target_vms ||= begin
          if env.multivm?
            return env.vms.values if !name
            vm = env.vms[name.to_sym]
            raise Errors::VMNotFoundError.new(:name => name) if !vm
          else
            raise Errors::MultiVMEnvironmentRequired.new if name
            vm = env.vms.values.first
          end

          [vm]
        end
      end
    end
  end
end
{'fraction_non_alphanumeric': 0.08442503639010189, 'fraction_numerical': 0.0, 'mean_word_length': 2.0822122571001493, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '7564270', 'n_tokens_mistral': 599, 'n_tokens_neox': 589, 'n_words': 188}