<commit_before>module AwsWrapper
  class SecurityGroup
    class << self
      # specify vpc by :id or :name
      def create(name, description, vpc)
        vpc_info = AwsWrapper::Vpc.find(vpc)
        return false if vpc_info.nil?
        ec2 = AWS::EC2.new
        res = ec2.client.create_security_group(:group_name => name,
                                               :description => description,
                                               :vpc_id => vpc_info[:vpc_id])
        find(:id => res[:group_id])
      end

      def delete(options = {})
        sg = find(options)
        return false if sg.nil?
        ec2 = AWS::EC2.new
        res = ec2.client.delete_security_group(:group_id => sg[:group_id])
        res[:return]
      end

      def exists?(options = {})
        find(options).nil? ? false : true
      end

      def find(options = {})
        ec2 = AWS::EC2.new
        res = ec2.client.describe_security_groups
        res[:security_group_info].each do |sg|
          return sg if options.has_key?(:name) and sg[:group_name] == options[:name]
          return sg if options.has_key?(:id) and sg[:group_id] == options[:id]
        end
        nil
      end
    end
  end
end
<commit_msg>set argument default value<commit_after>module AwsWrapper
  class SecurityGroup
    class << self
      # specify vpc by :id or :name
      def create(name, description, vpc = {})
        vpc_info = AwsWrapper::Vpc.find(vpc)
        return false if vpc_info.nil?
        ec2 = AWS::EC2.new
        res = ec2.client.create_security_group(:group_name => name,
                                               :description => description,
                                               :vpc_id => vpc_info[:vpc_id])
        find(:id => res[:group_id])
      end

      def delete(options = {})
        sg = find(options)
        return false if sg.nil?
        ec2 = AWS::EC2.new
        res = ec2.client.delete_security_group(:group_id => sg[:group_id])
        res[:return]
      end

      def exists?(options = {})
        find(options).nil? ? false : true
      end

      def find(options = {})
        ec2 = AWS::EC2.new
        res = ec2.client.describe_security_groups
        res[:security_group_info].each do |sg|
          return sg if options.has_key?(:name) and sg[:group_name] == options[:name]
          return sg if options.has_key?(:id) and sg[:group_id] == options[:id]
        end
        nil
      end
    end
  end
end

{'fraction_non_alphanumeric': 0.11124694376528117, 'fraction_numerical': 0.007334963325183374, 'mean_word_length': 1.796127562642369, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 8, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1869120', 'n_tokens_mistral': 743, 'n_tokens_neox': 729, 'n_words': 171}