<commit_before>//
//  Copyright 2016 Lionheart Software LLC
//
//  Licensed under the Apache License, Version 2.0 (the "License");
//  you may not use this file except in compliance with the License.
//  You may obtain a copy of the License at
//
//  http://www.apache.org/licenses/LICENSE-2.0
//
//  Unless required by applicable law or agreed to in writing, software
//  distributed under the License is distributed on an "AS IS" BASIS,
//  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
//  See the License for the specific language governing permissions and
//  limitations under the License.

import UIKit

public extension QuickTableViewSection where Self: RawRepresentable, Self.RawValue == Int {
    init(at indexPath: IndexPath) {
        self.init(at: indexPath.section)
    }

    init(at row: Int) {
        self.init(rawValue: row)!
    }

    static var count: Int {
        return lastSection.rawValue + 1
    }

    static var lastSection: Self {
        var section = Self(rawValue: 0)!
        for i in 0..<Int.max {
            guard let _section = Self(rawValue: i) else {
                return section
            }

            section = _section
        }

        return section
    }
}

public extension QuickTableViewSectionWithConditions where Self: RawRepresentable, Self.RawValue == Int {
    init(at indexPath: IndexPath, container: Container) {
        self.init(section: indexPath.section, container: container)
    }

    init(section: Int, container: Container) {
        var section = section
        let _conditionalRows = Self.conditionalSections(for: container)
        for (conditionalRow, test) in _conditionalRows {
            if section >= conditionalRow.rawValue && !test {
                section += 1
            }
        }
        self.init(rawValue: section)!
    }

    static func index(section: Self, container: Container) -> Int? {
        for i in 0..<count(container: container) {
            if section == Self(section: i, container: container) {
                return i
            }
        }

        return nil
    }

    static func count(container: Container) -> Int {
        var count = lastSection.rawValue + 1
        let _conditionalRows = conditionalSections(for: container)
        for (_, test) in _conditionalRows {
            if !test {<commit_msg>change syntax for conditional count<commit_after>//
//  Copyright 2016 Lionheart Software LLC
//
//  Licensed under the Apache License, Version 2.0 (the "License");
//  you may not use this file except in compliance with the License.
//  You may obtain a copy of the License at
//
//  http://www.apache.org/licenses/LICENSE-2.0
//
//  Unless required by applicable law or agreed to in writing, software
//  distributed under the License is distributed on an "AS IS" BASIS,
//  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
//  See the License for the specific language governing permissions and
//  limitations under the License.

import UIKit

public extension QuickTableViewSection where Self: RawRepresentable, Self.RawValue == Int {
    init(at indexPath: IndexPath) {
        self.init(at: indexPath.section)
    }

    init(at row: Int) {
        self.init(rawValue: row)!
    }

    static var count: Int {
        return lastSection.rawValue + 1
    }

    static var lastSection: Self {
        var section = Self(rawValue: 0)!
        for i in 0..<Int.max {
            guard let _section = Self(rawValue: i) else {
                return section
            }

            section = _section
        }

        return section
    }
}

public extension QuickTableViewSectionWithConditions where Self: RawRepresentable, Self.RawValue == Int {
    init(at indexPath: IndexPath, container: Container) {
        self.init(section: indexPath.section, container: container)
    }

    init(section: Int, container: Container) {
        var section = section
        let _conditionalRows = Self.conditionalSections(for: container)
        for (conditionalRow, test) in _conditionalRows {
            if section >= conditionalRow.rawValue && !test {
                section += 1
            }
        }
        self.init(rawValue: section)!
    }

    static func index(section: Self, container: Container) -> Int? {
        for i in 0..<count(for: container) {
            if section == Self(section: i, container: container) {
                return i
            }
        }

        return nil
    }

    static func count(for container: Container) -> Int {
        var count = lastSection.rawValue + 1
        let _conditionalRows = conditionalSections(for: container)
        for (_, test) in _conditionalRows {
            if !test {
{'fraction_non_alphanumeric': 0.0877490462060195, 'fraction_numerical': 0.005934718100890208, 'mean_word_length': 2.2816411682892905, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '3213469', 'n_tokens_mistral': 1289, 'n_tokens_neox': 1221, 'n_words': 439}