<commit_before>import {EventEmitter} from 'events';
import Dispatcher from './dispatcher';
import {ActionKind} from './constants';
import {ActionType} from './actions';

const USER_DIR = global.require('remote').require('app').getPath('userData');
const DATA_FILE_PATH = global.require('path').join(USER_DIR, 'repos.json');
const fs = global.require('fs');
const ipc: ElectronRenderer.InProcess = global.require('ipc');

class RepoStore extends EventEmitter {
    unread_repos: UnorderedreposList;
    current_repos: OrderedReposList;
    all_repos: UnorderedreposList;
    dispatch_token: string;
    last_update: number;
    lang_colors: {[lang: string]: string};

    loadStorage(name: string) {
        const saved = window.localStorage.getItem(name);
        if (saved) {
            return JSON.parse(saved);
        } else {
            return {};
        }
    }

    saveToStorage(name) {
        window.localStorage.setItem(name, JSON.stringify(this[name]));
    }

    saveAllToStorage() {
        this.saveToStorage('unread_repos');
        this.saveToStorage('current_repos');
        this.saveToStorage('all_repos');
    }

    constructor() {
        super();

        this.unread_repos = this.loadStorage('unread_repos');
        this.current_repos = this.loadStorage('current_repos');
        this.all_repos = this.loadStorage('all_repos');
        this.last_update = 0;
        this.lang_colors = null;
    }

    getAllRepos() {
        return this.all_repos;
    }

    getCurrentRepos() {
        return this.current_repos;
    }

    getUnreadRepos() {
        return this.unread_repos;
    }

    getLastUpdateTime() {
        if (this.last_update === 0) {
            return "";
        }

        return "Updated at " + new Date(this.last_update).toLocaleTimeString();
    }

    getAllColors() {
        return this.lang_colors;
    }

    getLangColor(lang: string) {
        if (this.lang_colors === null) {
            return null;
        }
        return this.lang_colors[lang];<commit_msg>use ' instead of "<commit_after>import {EventEmitter} from 'events';
import Dispatcher from './dispatcher';
import {ActionKind} from './constants';
import {ActionType} from './actions';

const USER_DIR = global.require('remote').require('app').getPath('userData');
const DATA_FILE_PATH = global.require('path').join(USER_DIR, 'repos.json');
const fs = global.require('fs');
const ipc: ElectronRenderer.InProcess = global.require('ipc');

class RepoStore extends EventEmitter {
    unread_repos: UnorderedreposList;
    current_repos: OrderedReposList;
    all_repos: UnorderedreposList;
    dispatch_token: string;
    last_update: number;
    lang_colors: {[lang: string]: string};

    loadStorage(name: string) {
        const saved = window.localStorage.getItem(name);
        if (saved) {
            return JSON.parse(saved);
        } else {
            return {};
        }
    }

    saveToStorage(name) {
        window.localStorage.setItem(name, JSON.stringify(this[name]));
    }

    saveAllToStorage() {
        this.saveToStorage('unread_repos');
        this.saveToStorage('current_repos');
        this.saveToStorage('all_repos');
    }

    constructor() {
        super();

        this.unread_repos = this.loadStorage('unread_repos');
        this.current_repos = this.loadStorage('current_repos');
        this.all_repos = this.loadStorage('all_repos');
        this.last_update = 0;
        this.lang_colors = null;
    }

    getAllRepos() {
        return this.all_repos;
    }

    getCurrentRepos() {
        return this.current_repos;
    }

    getUnreadRepos() {
        return this.unread_repos;
    }

    getLastUpdateTime() {
        if (this.last_update === 0) {
            return '';
        }

        return 'Updated at ' + new Date(this.last_update).toLocaleTimeString();
    }

    getAllColors() {
        return this.lang_colors;
    }

    getLangColor(lang: string) {
        if (this.lang_colors === null) {
            return null;
        }
        return this.lang_colors[lang];
{'fraction_non_alphanumeric': 0.12750185322461083, 'fraction_numerical': 0.0009883864591055103, 'mean_word_length': 2.683348498635123, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '870512', 'n_tokens_mistral': 1262, 'n_tokens_neox': 1203, 'n_words': 220}