<commit_before>//
//  Promise.swift
//  anim
//
//  Created by <NAME> on 2017-02-20.
//  Copyright (c) 2017 <NAME>. All rights reserved.

import Foundation

public extension anim {

    internal struct Promise {

        /// Promise state.
        ///
        /// - created: Animation did not started yet.
        /// - started: Animation is running.
        /// - finished: Animation finished running.
        /// - cancelled: Animation cancelled before it's finished.
        internal enum State {
            case created, started, finished, cancelled
        }

        /// Reference to next promise chained to this instance.
        internal var next: anim?
        /// Reference to previous promise this instance is chained.
        weak internal var prev: anim?
        /// State of promise.
        internal var state: State = .created

    }

    /// Creates a new animation promise with settings, chained to the previous one.
    ///
    /// - Parameter closure: Exposes settings values to block, and expects returning animation block.
    /// - Returns: Newly created promise.
    @discardableResult
    public func then(_ closureWithSettings: @escaping (inout animSettings) -> animClosure) -> anim {
        let nextAnim = anim(closureWithoutProcess: closureWithSettings)
        chain(to: nextAnim)
        return nextAnim
    }

    /// Creates a new animation promise, chained to the previous one.
    ///
    /// - Parameter closure: Animation block.
    /// - Returns: Newly created promise.
    @discardableResult
    public func then(_ closure: @escaping animClosure) -> anim {
        let nextAnim = anim(closureWithoutProcess: closure)
        chain(to: nextAnim)
        return nextAnim
    }

    /// Creates a promise only waits before running next promise.
    ///
    /// - Parameter milliseconds: Milliseconds to wait.
    /// - Returns: Newly created promise.
    @discardableResult
    public func wait(_ seconds: TimeInterval) -> anim {
        var settings = anim.defaultSettings
        settings.delay = seconds
        settings.duration = 0
        let nextAnim = anim(settings: settings, closure: {})
        chain(to: nextAnim)
        return nextAnim
    }

    /// Creates a promise only calls a block before running next promise.
    ///
    /// - Parameter closure: Block to be runned.
    /// - Returns: Newly created promise.
    @discardableResult
    public func callback(_ closure: @escaping animClosure) -> anim {
        var settings = anim.defaultSettings
        settings.delay = 0
        settings.duration = 0
        let nextAnim = anim(settings: settings, closure: closure)
        chain(to: nextAnim)
        return nextAnim
    }
<commit_msg>fixed warnings for redundant publics<commit_after>//
//  Promise.swift
//  anim
//
//  Created by <NAME> on 2017-02-20.
//  Copyright (c) 2017 <NAME>. All rights reserved.

import Foundation

public extension anim {

    internal struct Promise {

        /// Promise state.
        ///
        /// - created: Animation did not started yet.
        /// - started: Animation is running.
        /// - finished: Animation finished running.
        /// - cancelled: Animation cancelled before it's finished.
        internal enum State {
            case created, started, finished, cancelled
        }

        /// Reference to next promise chained to this instance.
        internal var next: anim?
        /// Reference to previous promise this instance is chained.
        weak internal var prev: anim?
        /// State of promise.
        internal var state: State = .created

    }

    /// Creates a new animation promise with settings, chained to the previous one.
    ///
    /// - Parameter closure: Exposes settings values to block, and expects returning animation block.
    /// - Returns: Newly created promise.
    @discardableResult
    func then(_ closureWithSettings: @escaping (inout animSettings) -> animClosure) -> anim {
        let nextAnim = anim(closureWithoutProcess: closureWithSettings)
        chain(to: nextAnim)
        return nextAnim
    }

    /// Creates a new animation promise, chained to the previous one.
    ///
    /// - Parameter closure: Animation block.
    /// - Returns: Newly created promise.
    @discardableResult
    func then(_ closure: @escaping animClosure) -> anim {
        let nextAnim = anim(closureWithoutProcess: closure)
        chain(to: nextAnim)
        return nextAnim
    }

    /// Creates a promise only waits before running next promise.
    ///
    /// - Parameter milliseconds: Milliseconds to wait.
    /// - Returns: Newly created promise.
    @discardableResult
    func wait(_ seconds: TimeInterval) -> anim {
        var settings = anim.defaultSettings
        settings.delay = seconds
        settings.duration = 0
        let nextAnim = anim(settings: settings, closure: {})
        chain(to: nextAnim)
        return nextAnim
    }

    /// Creates a promise only calls a block before running next promise.
    ///
    /// - Parameter closure: Block to be runned.
    /// - Returns: Newly created promise.
    @discardableResult
    func callback(_ closure: @escaping animClosure) -> anim {
        var settings = anim.defaultSettings
        settings.delay = 0
        settings.duration = 0
        let nextAnim = anim(settings: settings, closure: closure)
        chain(to: nextAnim)
        return nextAnim
    }

{'fraction_non_alphanumeric': 0.09281603861147206, 'fraction_numerical': 0.005568962316688323, 'mean_word_length': 2.1162521688837477, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 17, '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': '6841394', 'n_tokens_mistral': 1390, 'n_tokens_neox': 1317, 'n_words': 506}