<commit_before>import Foundation

/// The operator we define assings a value. Therefore its Precendencegroup is AssignmentPrecedence.
/// Used for optional properties
infix operator <->: AssignmentPrecedence


public func <-> <P>(lhs: inout P?, rhs: Any?) where P: Deserializable {
    guard let dict = rhs as? [String: Any] else {
        lhs = nil
        return
    }
    lhs = P(from: dict)
}

public func <-> <P>(lhs: inout [P]?, rhs: Any?) where P: Deserializable {
    guard let rawObjects = rhs as? [[String: Any]] else {
        lhs = nil
        return
    }
    lhs = rawObjects.flatMap { P(from: $0) }
}

/// MARK: - Deserialize operators

/// `Any?` is taken and set to the left hand side.
public func <-> (lhs: inout Int?, rhs: Any?) {
    lhs = rhs as? Int
}

public func <-> (lhs: inout Double?, rhs: Any?) {
    lhs = rhs as? Double
}

public func <-> (lhs: inout Bool?, rhs: Any?) {
    lhs = rhs as? Bool
}

public func <-> (lhs: inout String?, rhs: Any?) {
    lhs = rhs as? String
}

public func <-> (lhs: inout Date?, rhs: String?) {
    guard let date = rhs, DateParser.shared.dateFormat.characters.count > 0  else {
        return
    }

    lhs = DateParser.shared.dateFormatter.date(from: date)
}

public func <-> (lhs: inout Date?, rhs: TimeInterval?) {
    guard let timeInterval = rhs else {
        return
    }

    lhs = Date(timeIntervalSince1970: timeInterval)
}

public func <-> (lhs: inout Date?, rhs: (Any?, String)) {
    guard let date = rhs.0 as? String else {
        return
    }

    DateParser.shared.dateFormat = rhs.1
    lhs = DateParser.shared.dateFormatter.date(from: date)
}

<commit_msg>made dates accept an Any? object again so they don't need to be downcast by the implementer<commit_after>import Foundation

/// The operator we define assings a value. Therefore its Precendencegroup is AssignmentPrecedence.
/// Used for optional properties
infix operator <->: AssignmentPrecedence


public func <-> <P>(lhs: inout P?, rhs: Any?) where P: Deserializable {
    guard let dict = rhs as? [String: Any] else {
        lhs = nil
        return
    }
    lhs = P(from: dict)
}

public func <-> <P>(lhs: inout [P]?, rhs: Any?) where P: Deserializable {
    guard let rawObjects = rhs as? [[String: Any]] else {
        lhs = nil
        return
    }
    lhs = rawObjects.flatMap { P(from: $0) }
}

/// MARK: - Deserialize operators

/// `Any?` is taken and set to the left hand side.
public func <-> (lhs: inout Int?, rhs: Any?) {
    lhs = rhs as? Int
}

public func <-> (lhs: inout Double?, rhs: Any?) {
    lhs = rhs as? Double
}

public func <-> (lhs: inout Bool?, rhs: Any?) {
    lhs = rhs as? Bool
}

public func <-> (lhs: inout String?, rhs: Any?) {
    lhs = rhs as? String
}

public func <-> (lhs: inout Date?, rhs: Any?) {
    guard let date = rhs as? String, DateParser.shared.dateFormat.characters.count > 0  else {
        return
    }

    lhs = DateParser.shared.dateFormatter.date(from: date)
}

public func <-> (lhs: inout Date?, rhs: TimeInterval?) {
    guard let timeInterval = rhs else {
        return
    }

    lhs = Date(timeIntervalSince1970: timeInterval)
}

public func <-> (lhs: inout Date?, rhs: (Any?, String)) {
    guard let date = rhs.0 as? String else {
        return
    }

    DateParser.shared.dateFormat = rhs.1
    lhs = DateParser.shared.dateFormatter.date(from: date)
}


{'fraction_non_alphanumeric': 0.13355145746579417, 'fraction_numerical': 0.004759071980963712, 'mean_word_length': 2.749163879598662, 'pattern_counts': {'":': 0, '<': 27, '<?xml version=': 0, '>': 29, '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': '6879761', 'n_tokens_mistral': 1141, 'n_tokens_neox': 1116, 'n_words': 382}