<commit_before>package tw.shounenwind.plurkconnection.callbacks

import java.net.HttpURLConnection

import okhttp3.Response
import tw.shounenwind.plurkconnection.BuildablePlurkConnection
import tw.shounenwind.plurkconnection.PlurkConnectionException
import tw.shounenwind.plurkconnection.Tasks
import tw.shounenwind.plurkconnection.responses.ApiResponseString
import tw.shounenwind.plurkconnection.responses.IResponse

abstract class BasePlurkCallback<T : IResponse<*>> {

    private val tasks: Tasks? = null

    @Throws(Exception::class)
    protected abstract fun onSuccess(parsedResponse: T)

    fun onRetry(e: Throwable, retryTimes: Long, totalTimes: Long, errorAction: BuildablePlurkConnection.ErrorAction) {

    }

    fun onError(e: Throwable) {

    }

    @Throws(Exception::class)
    open fun runResult(response: Response) {
        if (response.code() != HttpURLConnection.HTTP_OK) {
            val exception = PlurkConnectionException(
                    ApiResponseString(response.code(), response.body()!!.string())
            )
            response.close()
            throw exception
        }
    }

}
<commit_msg>open fun<commit_after>package tw.shounenwind.plurkconnection.callbacks

import okhttp3.Response
import tw.shounenwind.plurkconnection.BuildablePlurkConnection
import tw.shounenwind.plurkconnection.PlurkConnectionException
import tw.shounenwind.plurkconnection.Tasks
import tw.shounenwind.plurkconnection.responses.ApiResponseString
import tw.shounenwind.plurkconnection.responses.IResponse
import java.net.HttpURLConnection

abstract class BasePlurkCallback<T : IResponse<*>> {

    private val tasks: Tasks? = null

    @Throws(Exception::class)
    protected abstract fun onSuccess(parsedResponse: T)

    open fun onRetry(e: Throwable, retryTimes: Long, totalTimes: Long, errorAction: BuildablePlurkConnection.ErrorAction) {

    }

    open fun onError(e: Throwable) {

    }

    @Throws(Exception::class)
    open fun runResult(response: Response) {
        if (response.code() != HttpURLConnection.HTTP_OK) {
            val exception = PlurkConnectionException(
                    ApiResponseString(response.code(), response.body()!!.string())
            )
            response.close()
            throw exception
        }
    }

}

{'fraction_non_alphanumeric': 0.08939526730937773, 'fraction_numerical': 0.0008764241893076249, 'mean_word_length': 3.7463617463617465, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, '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': '5566977', 'n_tokens_mistral': 681, 'n_tokens_neox': 668, 'n_words': 121}