<commit_before>import Foundation

/// An object that encodes instances of `Encodable` types as BSON Documents.
public class BSONEncoder {
    
    // MARK: Encoding
    
    /// Creates a new, reusable encoder with the given strategies
    public init(strategies: BSONEncoderStrategies = .default) {
        self.strategies = strategies
    }
    
    /// Returns the BSON-encoded representation of the value you supply
    ///
    /// If there's a problem encoding the value you supply, this method throws an error based on the type of problem:
    ///
    /// - The value fails to encode, or contains a nested value that fails to encode—this method throws the corresponding error.
    /// - The value can't be encoded as a BSON array or BSON object—this method throws the invalidValue error.
    public func encode<T : Encodable>(_ value: T) throws -> Document {
        let encoder = _BSONEncoder(strategies: self.strategies, userInfo: self.userInfo)
        
        try value.encode(to: encoder)
        
        return encoder.target.document
    }
    
    // MARK: Configuration
    <commit_msg>Use protocol type for BSONEncoder.encode<commit_after>import Foundation

/// An object that encodes instances of `Encodable` types as BSON Documents.
public class BSONEncoder {
    
    // MARK: Encoding
    
    /// Creates a new, reusable encoder with the given strategies
    public init(strategies: BSONEncoderStrategies = .default) {
        self.strategies = strategies
    }
    
    /// Returns the BSON-encoded representation of the value you supply
    ///
    /// If there's a problem encoding the value you supply, this method throws an error based on the type of problem:
    ///
    /// - The value fails to encode, or contains a nested value that fails to encode—this method throws the corresponding error.
    /// - The value can't be encoded as a BSON array or BSON object—this method throws the invalidValue error.
    public func encode(_ value: Encodable) throws -> Document {
        let encoder = _BSONEncoder(strategies: self.strategies, userInfo: self.userInfo)
        
        try value.encode(to: encoder)
        
        return encoder.target.document
    }
    
    // MARK: Configuration
    
{'fraction_non_alphanumeric': 0.07367475292003593, 'fraction_numerical': 0.0, 'mean_word_length': 2.5689102564102564, 'pattern_counts': {'":': 0, '<': 4, '<?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': '3623404', 'n_tokens_mistral': 592, 'n_tokens_neox': 569, 'n_words': 241}