<commit_before>package io.reactivex.rxkotlin

import io.reactivex.Flowable
import io.reactivex.functions.BiFunction
import io.reactivex.functions.Function3
import io.reactivex.functions.Function4
import io.reactivex.functions.Function5
import org.reactivestreams.Publisher


object FlowableKt {

    inline fun <T1,T2,R> combineLatest(source1: Flowable<T1>, source2: Flowable<T2>, crossinline combineFunction: (T1, T2) -> R) =
            Flowable.combineLatest(source1, source2,
                    BiFunction<T1, T2, R> { t1, t2 -> combineFunction(t1,t2) })!!

    inline fun <T1,T2,T3,R> combineLatest(source1: Flowable<T1>, source2: Flowable<T2>, source3: Flowable<T3>, crossinline combineFunction: (T1, T2, T3) -> R) =
            Flowable.combineLatest(source1, source2,source3,
                    io.reactivex.functions.Function3<T1, T2, T3, R> { t1: T1, t2: T2, t3: T3 -> combineFunction(t1,t2, t3) })!!

    inline fun <T1,T2,T3,T4,R> combineLatest(source1: Flowable<T1>, source2: Flowable<T2>, source3: Flowable<T3>,
                                             source4: Flowable<T4>, crossinline combineFunction: (T1, T2, T3, T4) -> R) =
            Flowable.combineLatest(source1, source2,source3, source4,
                    io.reactivex.functions.Function4<T1, T2, T3, T4, R> { t1: T1, t2: T2, t3: T3, t4: T4 -> combineFunction(t1,t2, t3, t4) })!!


    inline fun <T1,T2,T3,T4,T5,R> combineLatest(source1: Flowable<T1>, source2: Flowable<T2>,
                                                source3: Flowable<T3>, source4: Flowable<T4>,
                                                source5: Flowable<T5>, crossinline combineFunction: (T1, T2, T3, T4, T5) -> R) =
            Flowable.combineLatest(source1, source2,source3, source4, source5,
                    io.reactivex.functions.Function5<T1, T2, T3, T4, T5, R> { t1: T1, t2: T2, t3: T3, t4: T4, t5: T5 -> combineFunction(t1,t2, t3, t4, t5) })!!





    inline fun <T1,T2,R> zip(source1: Flowable<T1>, source2: Flowable<T2>, crossinline combineFunction: (T1, T2) -> R) =
            Flowable.zip(source1, source2,
                    BiFunction<T1, T2, R> { t1, t2 -> combineFunction(t1,t2) })!!

    inline fun <T1,T2,T3,R> zip(source1: Flowable<T1>, source2: Flowable<T2>, source3: Flowable<T3>, crossinline combineFunction: (T1, T2, T3) -> R) =
            Flowable.zip(source1, source2,source3,
                    io.reactivex.functions.Function3<T1, T2, T3, R> { t1: T1, t2: T2, t3: T3 -> combineFunction(t1,t2, t3) })!!

    inline fun <T1,T2,T3,T4,R> zip(source1: Flowable<T1>, source2: Flowable<T2>, source3: Flowable<T3>, source4: Flowable<T4>, crossinline combineFunction: (T1, T2, T3, T4) -> R) =
            Flowable.zip(source1, source2,source3, source4,
                    io.reactivex.functions.Function4<T1, T2, T3, T4, R> { t1: T1, t2: T2, t3: T3, t4: T4 -> combineFunction(t1,t2, t3, t4) })!!

    inline fun <T1,T2,T3,T4,T5,R> zip(source1: Flowable<T1>, source2: Flowable<T2>,
                                      source3: Flowable<T3>, source4: Flowable<T4>,
                                      source5: Flowable<T5>, crossinline combineFunction: (T1, T2, T3, T4, T5) -> R) =
            Flowable.zip(source1, source2,source3, source4, source5,
                    io.reactivex.functions.Function5<T1, T2, T3, T4, T5, R> { t1: T1, t2: T2, t3: T3, t4: T4, t5: T5 -> combineFunction(t1,t2, t3, t4, t5) })!!
}


/**
 * An alias to [Flowable.withLatestFrom], but allowing for cleaner lambda syntax.
 */
inline fun <T, U, R> Flowable<T>.withLatestFrom(other: Publisher<U>, crossinline combiner: (T, U) -> R): Flowable<R>
        = withLatestFrom(other, BiFunction<T, U, R> { t, u -> combiner.invoke(t, u)  })

/**
 * An alias to [Flowable.withLatestFrom], but allowing for cleaner lambda syntax.
 */
inline fun <T, T1, T2, R> Flowable<T>.withLatestFrom(o1: Publisher<T1>, o2: Publisher<T2>, crossinline combiner: (T, T1, T2) -> R): Flowable<R>
        = withLatestFrom(o1, o2, Function3<T, T1, T2, R> { t, t1, t2 -> combiner.invoke(t, t1, t2) })

/**
 * An alias to [Flowable.withLatestFrom], but allowing for cleaner lambda syntax.<commit_msg>add more zip() and combineLatest()<commit_after>package io.reactivex.rxkotlin

import io.reactivex.Flowable
import io.reactivex.functions.BiFunction
import io.reactivex.functions.Function3
import io.reactivex.functions.Function4
import io.reactivex.functions.Function5
import org.reactivestreams.Publisher


object FlowableKt {

    inline fun <T1,T2,R> combineLatest(source1: Flowable<T1>, source2: Flowable<T2>, crossinline combineFunction: (T1, T2) -> R) =
            Flowable.combineLatest(source1, source2,
                    BiFunction<T1, T2, R> { t1, t2 -> combineFunction(t1,t2) })!!

    inline fun <T1,T2,T3,R> combineLatest(source1: Flowable<T1>, source2: Flowable<T2>, source3: Flowable<T3>, crossinline combineFunction: (T1,T2, T3) -> R) =
            Flowable.combineLatest(source1, source2,source3,
                    io.reactivex.functions.Function3<T1, T2, T3, R> { t1: T1, t2: T2, t3: T3 -> combineFunction(t1,t2, t3) })!!

    inline fun <T1,T2,T3,T4,R> combineLatest(source1: Flowable<T1>, source2: Flowable<T2>, source3: Flowable<T3>,
                                             source4: Flowable<T4>, crossinline combineFunction: (T1,T2, T3, T4) -> R) =
            Flowable.combineLatest(source1, source2,source3, source4,
                    io.reactivex.functions.Function4<T1, T2, T3, T4, R> { t1: T1, t2: T2, t3: T3, t4: T4 -> combineFunction(t1,t2, t3, t4) })!!


    inline fun <T1,T2,T3,T4,T5,R> combineLatest(source1: Flowable<T1>, source2: Flowable<T2>,
                                                source3: Flowable<T3>, source4: Flowable<T4>,
                                                source5: Flowable<T5>, crossinline combineFunction: (T1,T2, T3, T4, T5) -> R) =
            Flowable.combineLatest(source1, source2,source3, source4, source5,
                    io.reactivex.functions.Function5<T1, T2, T3, T4, T5, R> { t1: T1, t2: T2, t3: T3, t4: T4, t5: T5 -> combineFunction(t1,t2, t3, t4, t5) })!!


    inline fun <T1,T2,T3,T4,T5,T6,R> combineLatest(source1: Flowable<T1>, source2: Flowable<T2>,
                                                   source3: Flowable<T3>, source4: Flowable<T4>,
                                                   source5: Flowable<T5>, source6: Flowable<T6>, crossinline combineFunction: (T1,T2, T3, T4, T5, T6) -> R) =
            Flowable.combineLatest(source1, source2,source3, source4, source5, source6,
                    io.reactivex.functions.Function6<T1, T2, T3, T4, T5, T6, R> { t1: T1, t2: T2, t3: T3, t4: T4, t5: T5, t6: T6 -> combineFunction(t1,t2, t3, t4, t5, t6) })!!

    inline fun <T1,T2,T3,T4,T5,T6,T7,R> combineLatest(source1: Flowable<T1>, source2: Flowable<T2>,
                                                      source3: Flowable<T3>, source4: Flowable<T4>,
                                                      source5: Flowable<T5>, source6: Flowable<T6>,
                                                      source7: Flowable<T7>, crossinline combineFunction: (T1,T2, T3, T4, T5, T6, T7) -> R) =
            Flowable.combineLatest(source1, source2,source3, source4, source5, source6, source7,
                    io.reactivex.functions.Function7<T1, T2, T3, T4, T5, T6, T7, R> { t1: T1, t2: T2, t3: T3, t4: T4, t5: T5, t6: T6, t7: T7 -> combineFunction(t1,t2, t3, t4, t5, t6, t7) })!!


    inline fun <T1,T2,T3,T4,T5,T6,T7,T8,R> combineLatest(source1: Flowable<T1>, source2: Flowable<T2>,
                                                         source3: Flowable<T3>, source4: Flowable<T4>,
                                                         source5: Flowable<T5>, source6: Flowable<T6>,
                                                         source7: Flowable<T7>, source8: Flowable<T8>,
                                                         crossinline combineFunction: (T1,T2, T3, T4, T5, T6, T7, T8) -> R) =
            Flowable.combineLatest(source1, source2,source3, source4, source5, source6, source7, source8,
                    io.reactivex.functions.Function8<T1, T2, T3, T4, T5, T6, T7, T8,R> { t1: T1, t2: T2, t3: T3, t4: T4, t5: T5, t6: T6, t7: T7, t8: T8 -> combineFunction(t1,t2, t3, t4, t5, t6, t7, t8) })!!

    inline fun <T1,T2,T3,T4,T5,T6,T7,T8,T9,R> combineLatest(source1: Flowable<T1>, source2: Flowable<T2>,
                                                            source3: Flowable<T3>, source4: Flowable<T4>,
                                                            source5: Flowable<T5>, source6: Flowable<T6>,
                                                            source7: Flowable<T7>, source8: Flowable<T8>,
                                                            source9: Flowable<T9>, crossinline combineFunction: (T1,T2, T3, T4, T5, T6, T7, T8, T9) -> R) =
            Flowable.combineLatest(source1, source2,source3, source4, source5, source6, source7, source8, source9,
                    io.reactivex.functions.Function9<T1, T2, T3, T4, T5, T6, T7, T8,T9,R> { t1: T1, t2: T2, t3: T3, t4: T4, t5: T5, t6: T6, t7: T7, t8: T8, t9: T9 -> combineFunction(t1,t2, t3, t4, t5, t6, t7, t8, t9) })!!




    inline fun <T1,T2,R> zip(source1: Flowable<T1>, source2: Flowable<T2>, crossinline combineFunction: (T1, T2) -> R) =
            Flowable.zip(source1, source2,
                    BiFunction<T1, T2, R> { t1, t2 -> combineFunction(t1,t2) })!!

    inline fun <T1,T2,T3,R> zip(source1: Flowable<T1>, source2: Flowable<T2>, source3: Flowable<T3>, crossinline combineFunction: (T1,T2, T3) -> R) =
            Flowable.zip(source1, source2,source3,
                    io.reactivex.functions.Function3<T1, T2, T3, R> { t1: T1, t2: T2, t3: T3 -> combineFunction(t1,t2, t3) })!!

    inline fun <T1,T2,T3,T4,R> zip(source1: Flowable<T1>, source2: Flowable<T2>, source3: Flowable<T3>, source4: Flowable<T4>, crossinline combineFunction: (T1,T2, T3, T4) -> R) =
            Flowable.zip(source1, source2,source3, source4,
                    io.reactivex.functions.Function4<T1, T2, T3, T4, R> { t1: T1, t2: T2, t3: T3, t4: T4 -> combineFunction(t1,t2, t3, t4) })!!

    inline fun <T1,T2,T3,T4,T5,R> zip(source1: Flowable<T1>, source2: Flowable<T2>,
                                      source3: Flowable<T3>, source4: Flowable<T4>,
                                      source5: Flowable<T5>, crossinline combineFunction: (T1,T2, T3, T4, T5) -> R) =
            Flowable.zip(source1, source2,source3, source4, source5,
                    io.reactivex.functions.Function5<T1, T2, T3, T4, T5, R> { t1: T1, t2: T2, t3: T3, t4: T4, t5: T5 -> combineFunction(t1,t2, t3, t4, t5) })!!



    inline fun <T1,T2,T3,T4,T5,T6,R> zip(source1: Flowable<T1>, source2: Flowable<T2>,
                                         source3: Flowable<T3>, source4: Flowable<T4>,
                                         source5: Flowable<T5>, source6: Flowable<T6>, crossinline combineFunction: (T1,T2, T3, T4, T5, T6) -> R) =
            Flowable.zip(source1, source2,source3, source4, source5, source6,
                    io.reactivex.functions.Function6<T1, T2, T3, T4, T5, T6, R> { t1: T1, t2: T2, t3: T3, t4: T4, t5: T5, t6: T6 -> combineFunction(t1,t2, t3, t4, t5, t6) })!!

    inline fun <T1,T2,T3,T4,T5,T6,T7,R> zip(source1: Flowable<T1>, source2: Flowable<T2>,
                                            source3: Flowable<T3>, source4: Flowable<T4>,
                                            source5: Flowable<T5>, source6: Flowable<T6>,
                                            source7: Flowable<T7>, crossinline combineFunction: (T1,T2, T3, T4, T5, T6, T7) -> R) =
            Flowable.zip(source1, source2,source3, source4, source5, source6, source7,
                    io.reactivex.functions.Function7<T1, T2, T3, T4, T5, T6, T7, R> { t1: T1, t2: T2, t3: T3, t4: T4, t5: T5, t6: T6, t7: T7 -> combineFunction(t1,t2, t3, t4, t5, t6, t7) })!!


    inline fun <T1,T2,T3,T4,T5,T6,T7,T8,R> zip(source1: Flowable<T1>, source2: Flowable<T2>,
                                               source3: Flowable<T3>, source4: Flowable<T4>,
                                               source5: Flowable<T5>, source6: Flowable<T6>,
                                               source7: Flowable<T7>, source8: Flowable<T8>,
                                               crossinline combineFunction: (T1,T2, T3, T4, T5, T6, T7, T8) -> R) =
            Flowable.zip(source1, source2,source3, source4, source5, source6, source7, source8,
                    io.reactivex.functions.Function8<T1, T2, T3, T4, T5, T6, T7, T8,R> { t1: T1, t2: T2, t3: T3, t4: T4, t5: T5, t6: T6, t7: T7, t8: T8 -> combineFunction(t1,t2, t3, t4, t5, t6, t7, t8) })!!

    inline fun <T1,T2,T3,T4,T5,T6,T7,T8,T9,R> zip(source1: Flowable<T1>, source2: Flowable<T2>,
                                                  source3: Flowable<T3>, source4: Flowable<T4>,
                                                  source5: Flowable<T5>, source6: Flowable<T6>,
                                                  source7: Flowable<T7>, source8: Flowable<T8>,
                                                  source9: Flowable<T9>, crossinline combineFunction: (T1,T2, T3, T4, T5, T6, T7, T8, T9) -> R) =
            Flowable.zip(source1, source2,source3, source4, source5, source6, source7, source8, source9,
                    io.reactivex.functions.Function9<T1, T2, T3, T4, T5, T6, T7, T8,T9,R> { t1: T1, t2: T2, t3: T3, t4: T4, t5: T5, t6: T6, t7: T7, t8: T8, t9: T9 -> combineFunction(t1,t2, t3, t4, t5, t6, t7, t8, t9) })!!

}

/**
 * An alias to [Flowable.withLatestFrom], but allowing for cleaner lambda syntax.
 */
inline fun <T, U, R> Flowable<T>.withLatestFrom(other: Publisher<U>, crossinline combiner: (T, U) -> R): Flowable<R>
        = withLatestFrom(other, BiFunction<T, U, R> { t, u -> combiner.invoke(t, u)  })

/**
 * An alias to [Flowable.withLatestFrom], but allowing for cleaner lambda syntax.
 */
inline fun <T, T1, T2, R> Flowable<T>.withLatestFrom(o1: Publisher<T1>, o2: Publisher<T2>, crossinline combiner: (T, T1, T2) -> R): Flowable<R>
        = withLatestFrom(o1, o2, Function3<T, T1, T2, R> { t, t1, t2 -> combiner.invoke(t, t1, t2) })

/**
 * An alias to [Flowable.withLatestFrom], but allowing for cleaner lambda syntax.
{'fraction_non_alphanumeric': 0.1462767813525019, 'fraction_numerical': 0.07648824063088841, 'mean_word_length': 2.322513331787619, 'pattern_counts': {'":': 0, '<': 189, '<?xml version=': 0, '>': 245, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 106, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7880', 'n_tokens_mistral': 5482, 'n_tokens_neox': 5367, 'n_words': 1219}