<commit_before>//
//  Calendar+Conversion.swift
//  Datez
//
//  Created by <NAME> on 11/7/15.
//  Copyright © 2015 kitz. All rights reserved.
//

import Foundation


extension Calendar {
    
    func components(_ units: Set<Calendar.Component>, fromTimeInterval timeInterval: TimeInterval) -> DateComponents {
        
        let baseDate = Date(timeIntervalSinceReferenceDate: 0)
        return dateComponents(units, from: baseDate, to: baseDate + timeInterval)
    }
}

extension Calendar {
    
    static var gregorian: Calendar            { return Calendar(identifier: Calendar.Identifier.gregorian) }
    static var buddhist: Calendar             { return Calendar(identifier: Calendar.Identifier.buddhist) }
    static var chinese: Calendar              { return Calendar(identifier: Calendar.Identifier.chinese) }
    static var coptic: Calendar               { return Calendar(identifier: Calendar.Identifier.coptic) }
    static var ethiopicAmeteMihret: Calendar  { return Calendar(identifier: Calendar.Identifier.ethiopicAmeteMihret) }
    static var ethiopicAmeteAlem: Calendar    { return Calendar(identifier: Calendar.Identifier.ethiopicAmeteAlem) }
    static var hebrew: Calendar               { return Calendar(identifier: Calendar.Identifier.hebrew) }
    static var iso8601: Calendar              { return Calendar(identifier: Calendar.Identifier.iso8601) }
    static var indian: Calendar               { return Calendar(identifier: Calendar.Identifier.indian) }
    static var islamic: Calendar              { return Calendar(identifier: Calendar.Identifier.islamic) }
    static var islamicCivil: Calendar         { return Calendar(identifier: Calendar.Identifier.islamicCivil) }
    static var japanese: Calendar             { return Calendar(identifier: Calendar.Identifier.japanese) }
    static var persian: Calendar              { return Calendar(identifier: Calendar.Identifier.persian) }
    static var republicOfChina: Calendar      { return Calendar(identifier: Calendar.Identifier.republicOfChina) }
}

public extension Calendar.Component {
    
    public static var all: Set<Calendar.Component> {
        return [
            .calendar, .day, .era, .hour, .minute, .month, .nanosecond, .quarter, .second,
            .timeZone, .weekday, .weekdayOrdinal, .weekOfMonth, .weekOfYear, .year, .yearForWeekOfYear
        ]
    }
}<commit_msg>Resolve constant calendar creation performance<commit_after>//
//  Calendar+Conversion.swift
//  Datez
//
//  Created by <NAME> on 11/7/15.
//  Copyright © 2015 kitz. All rights reserved.
//

import Foundation


extension Calendar {
    
    func components(_ units: Set<Calendar.Component>, fromTimeInterval timeInterval: TimeInterval) -> DateComponents {
        
        let baseDate = Date(timeIntervalSinceReferenceDate: 0)
        return dateComponents(units, from: baseDate, to: baseDate + timeInterval)
    }
}

extension Calendar {
    
    static let gregorian              = Calendar(identifier: .gregorian)
    static let buddhist               = Calendar(identifier: .buddhist)
    static let chinese                = Calendar(identifier: .chinese)
    static let coptic                 = Calendar(identifier: .coptic)
    static let ethiopicAmeteMihret    = Calendar(identifier: .ethiopicAmeteMihret)
    static let ethiopicAmeteAlem      = Calendar(identifier: .ethiopicAmeteAlem)
    static let hebrew                 = Calendar(identifier: .hebrew)
    static let iso8601                = Calendar(identifier: .iso8601)
    static let indian                 = Calendar(identifier: .indian)
    static let islamic                = Calendar(identifier: .islamic)
    static let islamicCivil           = Calendar(identifier: .islamicCivil)
    static let japanese               = Calendar(identifier: .japanese)
    static let persian                = Calendar(identifier: .persian)
    static let republicOfChina        = Calendar(identifier: .republicOfChina)
}

public extension Calendar.Component {
    
    public static var all: Set<Calendar.Component> {
        return [
            .calendar, .day, .era, .hour, .minute, .month, .nanosecond, .quarter, .second,
            .timeZone, .weekday, .weekdayOrdinal, .weekOfMonth, .weekOfYear, .year, .yearForWeekOfYear
        ]
    }
}
{'fraction_non_alphanumeric': 0.08744447042319382, 'fraction_numerical': 0.008417114800093524, 'mean_word_length': 2.7232375979112273, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 11, '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': '6890101', 'n_tokens_mistral': 1245, 'n_tokens_neox': 1126, 'n_words': 302}