<commit_before>/*
 * Copyright (c) 2019 toastkidjp.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompany this distribution.
 * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html.
 */
package jp.toastkid.rss.extractor

import android.content.Context
import android.view.View
import androidx.annotation.VisibleForTesting
import androidx.fragment.app.FragmentActivity
import androidx.lifecycle.ViewModelProvider
import androidx.lifecycle.ViewModelStoreOwner
import jp.toastkid.api.html.HtmlApi
import jp.toastkid.lib.ContentViewModel
import jp.toastkid.lib.preference.ColorPair
import jp.toastkid.lib.preference.PreferenceApplier
import jp.toastkid.rss.R
import kotlinx.coroutines.CoroutineDispatcher
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext

/**
 * @author toastkidjp
 */
class RssUrlFinder(
    private val preferenceApplier: PreferenceApplier,
    private val urlValidator: RssUrlValidator = RssUrlValidator(),
    private val rssUrlExtractor: RssUrlExtractor = RssUrlExtractor(),
    private val htmlApi: HtmlApi = HtmlApi(),
    private val contentViewModelFactory: (ViewModelStoreOwner) -> ContentViewModel? = {
        ViewModelProvider(it).get(ContentViewModel::class.java)
    },
    @VisibleForTesting
    private val mainDispatcher: CoroutineDispatcher = Dispatchers.Main,
    @VisibleForTesting
    private val ioDispatcher: CoroutineDispatcher = Dispatchers.IO
) {


    operator fun invoke(
            currentUrl: String?,
            snackbarParentSupplier: () -> View?
    ) {
        if (currentUrl.isNullOrBlank()) {
            return
        }

        val snackbarParent = snackbarParentSupplier() ?: return
        val colorPair = preferenceApplier.colorPair()
<commit_msg>refactor #232 Add @VisibleForTesting.<commit_after>/*
 * Copyright (c) 2019 toastkidjp.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompany this distribution.
 * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html.
 */
package jp.toastkid.rss.extractor

import android.content.Context
import android.view.View
import androidx.annotation.VisibleForTesting
import androidx.fragment.app.FragmentActivity
import androidx.lifecycle.ViewModelProvider
import androidx.lifecycle.ViewModelStoreOwner
import jp.toastkid.api.html.HtmlApi
import jp.toastkid.lib.ContentViewModel
import jp.toastkid.lib.preference.ColorPair
import jp.toastkid.lib.preference.PreferenceApplier
import jp.toastkid.rss.R
import kotlinx.coroutines.CoroutineDispatcher
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext

/**
 * @author toastkidjp
 */
class RssUrlFinder(
    private val preferenceApplier: PreferenceApplier,
    private val urlValidator: RssUrlValidator = RssUrlValidator(),
    private val rssUrlExtractor: RssUrlExtractor = RssUrlExtractor(),
    private val htmlApi: HtmlApi = HtmlApi(),
    @VisibleForTesting
    private val contentViewModelFactory: (ViewModelStoreOwner) -> ContentViewModel? = {
        ViewModelProvider(it).get(ContentViewModel::class.java)
    },
    @VisibleForTesting
    private val mainDispatcher: CoroutineDispatcher = Dispatchers.Main,
    @VisibleForTesting
    private val ioDispatcher: CoroutineDispatcher = Dispatchers.IO
) {


    operator fun invoke(
            currentUrl: String?,
            snackbarParentSupplier: () -> View?
    ) {
        if (currentUrl.isNullOrBlank()) {
            return
        }

        val snackbarParent = snackbarParentSupplier() ?: return
        val colorPair = preferenceApplier.colorPair()

{'fraction_non_alphanumeric': 0.07932875667429443, 'fraction_numerical': 0.004830917874396135, 'mean_word_length': 4.316216216216216, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '4890584', 'n_tokens_mistral': 1183, 'n_tokens_neox': 1120, 'n_words': 264}