<commit_before>import { ReduxLoader } from '../../reusable/redux_loader/base'
import { objectAssign, Promise } from '../../reusable/ponyfill'
import Immutable from 'immutable'

const MAX_PAGES = 5

const LoaderState = Immutable.Record({
    queue: Immutable.OrderedSet(),
    inprogress: Immutable.Set(),
    done: Immutable.Set(),
    perLoad: 1
})

export class TabbedReportManager extends ReduxLoader {
    constructor(opts) {
        super(opts)
        this.init_action = opts.prefix + '/init'
        this.queue_action = opts.prefix + '/queue'
        this.start_action = opts.prefix + '/start'
        this.finish_action = opts.prefix + '/finish'
        this.replace_action = opts.prefix + '/replace'
        this.replace_items_action = opts.prefix + '/replace_items'
    }

    extraReducers(opts) {
        let init = {}
        if (opts.report) {
            init.queue = this._queueFromReport(opts.report)
        }

        const defaultState = new LoaderState(init)

        const lsReducer = (state=defaultState, action) => {
            if (action.type.startsWith(opts.prefix)) {<commit_msg>Hack in String.startsWith polyfill for now<commit_after>import { ReduxLoader } from '../../reusable/redux_loader/base'
import { objectAssign, Promise } from '../../reusable/ponyfill'
import Immutable from 'immutable'

const MAX_PAGES = 5

const LoaderState = Immutable.Record({
    queue: Immutable.OrderedSet(),
    inprogress: Immutable.Set(),
    done: Immutable.Set(),
    perLoad: 1
})

if (!String.prototype.startsWith) {
    String.prototype.startsWith = function(searchString, position) {
        position = position || 0
        return this.substr(position, searchString.length) === searchString
    }
}

export class TabbedReportManager extends ReduxLoader {
    constructor(opts) {
        super(opts)
        this.init_action = opts.prefix + '/init'
        this.queue_action = opts.prefix + '/queue'
        this.start_action = opts.prefix + '/start'
        this.finish_action = opts.prefix + '/finish'
        this.replace_action = opts.prefix + '/replace'
        this.replace_items_action = opts.prefix + '/replace_items'
    }

    extraReducers(opts) {
        let init = {}
        if (opts.report) {
            init.queue = this._queueFromReport(opts.report)
        }

        const defaultState = new LoaderState(init)

        const lsReducer = (state=defaultState, action) => {
            if (action.type.startsWith(opts.prefix)) {
{'fraction_non_alphanumeric': 0.12210953346855984, 'fraction_numerical': 0.002028397565922921, 'mean_word_length': 2.7591463414634148, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '6885913', 'n_tokens_mistral': 738, 'n_tokens_neox': 727, 'n_words': 155}