<commit_before>//
//  CKRecordZone+Rx.swift
//  RxCloudKit
//
//  Created by <NAME> on 10/08/2017.
//  Copyright (c) RxSwiftCommunity. All rights reserved.
//

import RxSwift
import CloudKit

public extension Reactive where Base: CKRecordZone {

    static func fetch(with recordZoneID: CKRecordZone.ID, in database: CKDatabase) -> Maybe<CKRecordZone> {
        return Maybe<CKRecordZone>.create { maybe in
            database.fetch(withRecordZoneID: recordZoneID) { (zone, error) in
                if let error = error {
                    maybe(.error(error))
                    return
                }
                guard zone != nil else {
                    maybe(.completed)
                    return
                }
                maybe(.success(zone!))
            }
            return Disposables.create()
        }
    }

    static func modify(recordZonesToSave: [CKRecordZone]?, recordZoneIDsToDelete: [CKRecordZone.ID]?, in database: CKDatabase) -> Single<([CKRecordZone]?, [CKRecordZone.ID]?)> {
        return Single<([CKRecordZone]?, [CKRecordZone.ID]?)>.create { single in
            let operation = CKModifyRecordZonesOperation(recordZonesToSave: recordZonesToSave, recordZoneIDsToDelete: recordZoneIDsToDelete)
            operation.qualityOfService = .userInitiated
            operation.modifyRecordZonesCompletionBlock = { (saved, deleted, error) in
                if let error = error {
                    single(.error(error))
                    return
                }
                single(.success((saved, deleted)))
            }
            database.add(operation)
            return Disposables.create()
        }
    }

    static func fetchChanges(previousServerChangeToken: CKServerChangeToken?, limit: Int = 400, in database: CKDatabase) -> Observable<ZoneEvent> {
        return Observable.create { observer in
            _ = ZoneChangeFetcher(observer: observer, database: database, previousServerChangeToken: previousServerChangeToken, limit: limit)
            return Disposables.create()
        }
    }

}
<commit_msg>@available(iOS 10, *)<commit_after>//
//  CKRecordZone+Rx.swift
//  RxCloudKit
//
//  Created by <NAME>gin on 10/08/2017.
//  Copyright (c) RxSwiftCommunity. All rights reserved.
//

import RxSwift
import CloudKit

@available(iOS 10, *)
public extension Reactive where Base: CKRecordZone {

    static func fetch(with recordZoneID: CKRecordZone.ID, in database: CKDatabase) -> Maybe<CKRecordZone> {
        return Maybe<CKRecordZone>.create { maybe in
            database.fetch(withRecordZoneID: recordZoneID) { (zone, error) in
                if let error = error {
                    maybe(.error(error))
                    return
                }
                guard zone != nil else {
                    maybe(.completed)
                    return
                }
                maybe(.success(zone!))
            }
            return Disposables.create()
        }
    }

    static func modify(recordZonesToSave: [CKRecordZone]?, recordZoneIDsToDelete: [CKRecordZone.ID]?, in database: CKDatabase) -> Single<([CKRecordZone]?, [CKRecordZone.ID]?)> {
        return Single<([CKRecordZone]?, [CKRecordZone.ID]?)>.create { single in
            let operation = CKModifyRecordZonesOperation(recordZonesToSave: recordZonesToSave, recordZoneIDsToDelete: recordZoneIDsToDelete)
            operation.qualityOfService = .userInitiated
            operation.modifyRecordZonesCompletionBlock = { (saved, deleted, error) in
                if let error = error {
                    single(.error(error))
                    return
                }
                single(.success((saved, deleted)))
            }
            database.add(operation)
            return Disposables.create()
        }
    }

    static func fetchChanges(previousServerChangeToken: CKServerChangeToken?, limit: Int = 400, in database: CKDatabase) -> Observable<ZoneEvent> {
        return Observable.create { observer in
            _ = ZoneChangeFetcher(observer: observer, database: database, previousServerChangeToken: previousServerChangeToken, limit: limit)
            return Disposables.create()
        }
    }

}

{'fraction_non_alphanumeric': 0.0960114640554096, 'fraction_numerical': 0.006209696680200621, 'mean_word_length': 2.1160714285714284, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 21, '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': '6865232', 'n_tokens_mistral': 1157, 'n_tokens_neox': 1057, 'n_words': 248}