<commit_before>unless Fog.mocking?

  module Fog
    module AWS
      class S3

        # Create an S3 bucket
        #
        # ==== Parameters
        # * bucket_name<~String> - name of bucket to create
        # * options<~Hash> - config arguments for bucket.  Defaults to {}.
        #   * :location_constraint<~Symbol> - sets the location for the bucket
        #
        # ==== Returns
        # * response<~Fog::AWS::Response>:
        #   * status<~Integer> - 200
        def put_bucket(bucket_name, options = {})
          if options['LocationConstraint']
            data =
  <<-DATA
    <CreateBucketConfiguration>
      <LocationConstraint>#{options['LocationConstraint']}</LocationConstraint>
    </CreateBucketConfiguration>
  DATA
          else
            data = nil
          end
          request({
            :expects  => 200,
            :body     => data,
            :headers  => {},
            :host     => "#{bucket_name}.#{@host}",
            :method   => 'PUT'
          })
        end

      end
    end
  end

else

  module Fog
    module AWS
      class S3

        def put_bucket(bucket_name, options = {})
          response = Fog::Response.new
          response.status = 200
          bucket = {
            :objects        => {},
            'Name'          => bucket_name,
            'CreationDate'  => Time.now,
            'Payer'         => 'BucketOwner'
          }
          if options['LocationConstraint']
            bucket['LocationConstraint'] = options['LocationConstraint']
          else
            bucket['LocationConstraint'] = ''
          end
          Fog::AWS::S3.data[:buckets][bucket_name] = bucket
          response
        end

      end
    end
  end

end<commit_msg>put_bucket should be idempotent<commit_after>unless Fog.mocking?

  module Fog
    module AWS
      class S3

        # Create an S3 bucket
        #
        # ==== Parameters
        # * bucket_name<~String> - name of bucket to create
        # * options<~Hash> - config arguments for bucket.  Defaults to {}.
        #   * :location_constraint<~Symbol> - sets the location for the bucket
        #
        # ==== Returns
        # * response<~Fog::AWS::Response>:
        #   * status<~Integer> - 200
        def put_bucket(bucket_name, options = {})
          if options['LocationConstraint']
            data =
  <<-DATA
    <CreateBucketConfiguration>
      <LocationConstraint>#{options['LocationConstraint']}</LocationConstraint>
    </CreateBucketConfiguration>
  DATA
          else
            data = nil
          end
          request({
            :expects  => 200,
            :body     => data,
            :headers  => {},
            :host     => "#{bucket_name}.#{@host}",
            :method   => 'PUT'
          })
        end

      end
    end
  end

else

  module Fog
    module AWS
      class S3

        def put_bucket(bucket_name, options = {})
          response = Fog::Response.new
          response.status = 200
          bucket = {
            :objects        => {},
            'Name'          => bucket_name,
            'CreationDate'  => Time.now,
            'Payer'         => 'BucketOwner'
          }
          if options['LocationConstraint']
            bucket['LocationConstraint'] = options['LocationConstraint']
          else
            bucket['LocationConstraint'] = ''
          end
          unless Fog::AWS::S3.data[:buckets][bucket_name]
            Fog::AWS::S3.data[:buckets][bucket_name] = bucket
          end
          response
        end

      end
    end
  end

end
{'fraction_non_alphanumeric': 0.11229646266142616, 'fraction_numerical': 0.007580011229646266, 'mean_word_length': 1.526950354609929, 'pattern_counts': {'":': 0, '<': 25, '<?xml version=': 0, '>': 39, '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': '7470890', 'n_tokens_mistral': 982, 'n_tokens_neox': 951, 'n_words': 211}