<commit_before>//
//  AKAKMIDIFileChunk.swift
//  AudioKit
//
//  Created by <NAME> on 11/1/18.
//  Copyright © 2018 AudioKit. All rights reserved.
//

import Foundation

public protocol AKMIDIFileChunk {
    var typeData: [UInt8] { get set }
    var lengthData: [UInt8] { get set }
    var data: [UInt8] { get set }
    init()
    init(typeData: [UInt8], lengthData: [UInt8], data: [UInt8])
}

extension AKMIDIFileChunk {

    public init(typeData: [UInt8], lengthData: [UInt8], data: [UInt8]) {
        self.init()
        self.typeData = typeData
        self.lengthData = lengthData
        self.data = data
        if !isValid {
            fatalError("Type and length must be 4 bytes long, length must equal amount of data")
        }
    }

    public var isValid: Bool {
        return isTypeValid && isLengthValid
    }

    var isTypeValid: Bool { return typeData.count == 4 && lengthData.count == 4 }
    var isLengthValid: Bool { return data.count == length }

    public var length: Int {
        return combine(bytes: lengthData)
    }
<commit_msg>tighten up variable in midifilechucnk<commit_after>//
//  AKAKMIDIFileChunk.swift
//  AudioKit
//
//  Created by <NAME> on 11/1/18.
//  Copyright © 2018 AudioKit. All rights reserved.
//

import Foundation

public protocol AKMIDIFileChunk {
    var typeData: [UInt8] { get set }
    var lengthData: [UInt8] { get set }
    var data: [UInt8] { get set }
    init()
    init(typeData: [UInt8], lengthData: [UInt8], data: [UInt8])
}

extension AKMIDIFileChunk {

    public init(typeData: [UInt8], lengthData: [UInt8], data: [UInt8]) {
        self.init()
        self.typeData = typeData
        self.lengthData = lengthData
        self.data = data
        if !isValid {
            fatalError("Type and length must be 4 bytes long, length must equal amount of data")
        }
    }

    public var isValid: Bool { return isTypeValid && isLengthValid }
    var isTypeValid: Bool { return typeData.count == 4 && lengthData.count == 4 }
    var isLengthValid: Bool { return data.count == length }

    public var length: Int {
        return combine(bytes: lengthData)
    }

{'fraction_non_alphanumeric': 0.11147540983606558, 'fraction_numerical': 0.019672131147540985, 'mean_word_length': 2.57190635451505, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '2645957', 'n_tokens_mistral': 706, 'n_tokens_neox': 664, 'n_words': 208}