<commit_before>//
// This source file is part of the MongoKitten open source project
//
// Copyright (c) 2016 - 2017 OpenKitten and the MongoKitten project authors
// Licensed under MIT
//
// See https://github.com/OpenKitten/MongoKitten/blob/mongokitten31/LICENSE.md for license information
// See https://github.com/OpenKitten/MongoKitten/blob/mongokitten31/CONTRIBUTORS.md for the list of MongoKitten project authors
//

import Foundation

/// MongoDriverInformation allows to add extra information about the driver. This information is then available in the MongoD/MongoS logs.
///
/// - SeeAlso : https://github.com/mongodb/specifications/blob/master/source/mongodb-handshake/handshake.rst
struct MongoDriverInformation: ValueConvertible {

    /// Application Name
    let appName: String?

    /// Converts this to an embeddable BSON.Primitive
    public func makePrimitive() -> BSON.Primitive {
        let driver: Document = ["name":"MongoKitten","version":"3.1.5"]

        var client: Document = ["driver": driver]

        if client.byteCount < 512 {
            #if os(Linux)
                var os: Document = ["type":"Linux"]
            #else
                var os: Document = ["type":"Darwin"]
            #endif

            if ProcessInfo.processInfo.operatingSystemVersion.majorVersion != -1 {<commit_msg>Updated driver version in advance<commit_after>//
// This source file is part of the MongoKitten open source project
//
// Copyright (c) 2016 - 2017 OpenKitten and the MongoKitten project authors
// Licensed under MIT
//
// See https://github.com/OpenKitten/MongoKitten/blob/mongokitten31/LICENSE.md for license information
// See https://github.com/OpenKitten/MongoKitten/blob/mongokitten31/CONTRIBUTORS.md for the list of MongoKitten project authors
//

import Foundation

/// MongoDriverInformation allows to add extra information about the driver. This information is then available in the MongoD/MongoS logs.
///
/// - SeeAlso : https://github.com/mongodb/specifications/blob/master/source/mongodb-handshake/handshake.rst
struct MongoDriverInformation: ValueConvertible {

    /// Application Name
    let appName: String?

    /// Converts this to an embeddable BSON.Primitive
    public func makePrimitive() -> BSON.Primitive {
        let driver: Document = ["name":"MongoKitten","version":"4.0.0"]

        var client: Document = ["driver": driver]

        if client.byteCount < 512 {
            #if os(Linux)
                var os: Document = ["type":"Linux"]
            #else
                var os: Document = ["type":"Darwin"]
            #endif

            if ProcessInfo.processInfo.operatingSystemVersion.majorVersion != -1 {
{'fraction_non_alphanumeric': 0.10853293413173652, 'fraction_numerical': 0.014221556886227544, 'mean_word_length': 2.9366715758468334, 'pattern_counts': {'":': 10, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 6, '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': '2493556', 'n_tokens_mistral': 775, 'n_tokens_neox': 712, 'n_words': 216}