<commit_before>import Foundation
import Vapor
import HTTP

extension S3 {
    
    /// Make an S3 request
    func make(request url: URL, method: HTTPMethod, headers: HTTPHeaders, data: Data? = nil, cachePolicy: URLRequest.CachePolicy = .useProtocolCachePolicy, on container: Container) throws -> Future<Response> {
        var request = URLRequest(url: url, cachePolicy: cachePolicy)
        request.httpMethod = method.string
        request.httpBody = data ?? Data()
        headers.forEach { key, val in
            request.addValue(val, forHTTPHeaderField: key.description)
        }
        
        return execute(request, on: container)
    }
    
    /// Execute given request with URLSession.shared
    func execute(_ request: URLRequest, on container: Container) -> Future<Response> {
        let promise = container.eventLoop.newPromise(Response.self)
        
        URLSession.shared.dataTask(with: request, completionHandler: { (data, urlResponse, error) in
            if let error = error {
                promise.fail(error: error)
                return
            }
            
            guard let httpResponse = urlResponse as? HTTPURLResponse else {
                let error = VaporError(identifier: "httpURLResponse", reason: "URLResponse was not a HTTPURLResponse.")
                promise.fail(error: error)
                return
            }
            
            let response = S3.convertFromFoundationResponse(httpResponse, data: data, on: container)
            
            promise.succeed(result: Response(http: response, using: container))
        }).resume()
        
        return promise.futureResult
    }
    
    /// Convert given response and data to HTTPResponse from Vapors HTTP package
    static func convertFromFoundationResponse(_ httpResponse: HTTPURLResponse, data: Data?, on worker: Worker) -> HTTPResponse {
        var res = HTTPResponse(status: .init(statusCode: httpResponse.statusCode))
        if let data = data {
            res.body = HTTPBody(data: data)
        }
        for (key, value) in httpResponse.allHeaderFields {
            res.headers.replaceOrAdd(name: "\(key)", value: "\(value)")
        }
        return res
    }
    
}<commit_msg>Use Swift.init instead of interpolation<commit_after>import Foundation
import Vapor
import HTTP

extension S3 {
    
    /// Make an S3 request
    func make(request url: URL, method: HTTPMethod, headers: HTTPHeaders, data: Data? = nil, cachePolicy: URLRequest.CachePolicy = .useProtocolCachePolicy, on container: Container) throws -> Future<Response> {
        var request = URLRequest(url: url, cachePolicy: cachePolicy)
        request.httpMethod = method.string
        request.httpBody = data ?? Data()
        headers.forEach { key, val in
            request.addValue(val, forHTTPHeaderField: key.description)
        }
        
        return execute(request, on: container)
    }
    
    /// Execute given request with URLSession.shared
    func execute(_ request: URLRequest, on container: Container) -> Future<Response> {
        let promise = container.eventLoop.newPromise(Response.self)
        
        URLSession.shared.dataTask(with: request, completionHandler: { (data, urlResponse, error) in
            if let error = error {
                promise.fail(error: error)
                return
            }
            
            guard let httpResponse = urlResponse as? HTTPURLResponse else {
                let error = VaporError(identifier: "httpURLResponse", reason: "URLResponse was not a HTTPURLResponse.")
                promise.fail(error: error)
                return
            }
            
            let response = S3.convertFromFoundationResponse(httpResponse, data: data, on: container)
            
            promise.succeed(result: Response(http: response, using: container))
        }).resume()
        
        return promise.futureResult
    }
    
    /// Convert given response and data to HTTPResponse from Vapors HTTP package
    static func convertFromFoundationResponse(_ httpResponse: HTTPURLResponse, data: Data?, on worker: Worker) -> HTTPResponse {
        var res = HTTPResponse(status: .init(statusCode: httpResponse.statusCode))
        if let data = data {
            res.body = HTTPBody(data: data)
        }
        for (key, value) in httpResponse.allHeaderFields {
            res.headers.replaceOrAdd(name: String(key), value: String(value))
        }
        return res
    }
    
}
{'fraction_non_alphanumeric': 0.08694680375502906, 'fraction_numerical': 0.0013410818059901655, 'mean_word_length': 2.275988286969253, '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': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6704055', 'n_tokens_mistral': 1124, 'n_tokens_neox': 1118, 'n_words': 330}