<commit_before>import * as fs from "fs";
import * as _ from "lodash";
import Job from "./Job";
import History from "./History";
import Utils from "./Utils";
import Serializer from "./Serializer";
import EmitterWithUniqueID from "./EmitterWithUniqueID";
import PluginManager from "./PluginManager";
import {Status} from "./Enums";
const remote = require("remote");
const app = remote.require("app");
const browserWindow: typeof Electron.BrowserWindow = remote.require("electron").BrowserWindow;

export default class Terminal extends EmitterWithUniqueID {
    jobs: Array<Job> = [];
    history: typeof History;
    private _currentDirectory: string;
    private stateFileName = `${Utils.homeDirectory}/.black-screen-state`;
    // The value of the dictionary is the default value used if there is no serialized data.
    private serializableProperties: Dictionary<any> = {
        currentDirectory: `String:${Utils.homeDirectory}`,
        history: `History:[]`,
    };

    constructor(private _dimensions: Dimensions) {
        super();

        // TODO: We want to deserialize properties only for the first instance
        // TODO: of Terminal for the application.
        this.deserialize();
        this.history = History;

        this.on("job", this.serialize.bind(this));

        this.clearJobs();
    }

    createJob(): void {
        const job = new Job(this);

        job.once("end", () => {
            if (app.dock && !_.some(browserWindow.getAllWindows(), window => window.isFocused())) {
                app.dock.bounce("informational");
                // Those two strings are smiling and frowning faces.
                const smiley = job.status === Status.Success ? "🙂" : "🙁";
                app.dock.setBadge(smiley);
            }
            this.createJob();
        });

        this.jobs = this.jobs.concat(job);
        this.emit("job");
    }

    get dimensions(): Dimensions {
        return this._dimensions;
    }

    set dimensions(value: Dimensions) {
        this._dimensions = value;
        this.jobs.forEach(job => job.winch());
    }

    clearJobs(): void {
        this.jobs = [];
        this.createJob();
    }<commit_msg>Show normal symbols instead of smileys in the badge.<commit_after>import * as fs from "fs";
import * as _ from "lodash";
import Job from "./Job";
import History from "./History";
import Utils from "./Utils";
import Serializer from "./Serializer";
import EmitterWithUniqueID from "./EmitterWithUniqueID";
import PluginManager from "./PluginManager";
import {Status} from "./Enums";
const remote = require("remote");
const app = remote.require("app");
const browserWindow: typeof Electron.BrowserWindow = remote.require("electron").BrowserWindow;

export default class Terminal extends EmitterWithUniqueID {
    jobs: Array<Job> = [];
    history: typeof History;
    private _currentDirectory: string;
    private stateFileName = `${Utils.homeDirectory}/.black-screen-state`;
    // The value of the dictionary is the default value used if there is no serialized data.
    private serializableProperties: Dictionary<any> = {
        currentDirectory: `String:${Utils.homeDirectory}`,
        history: `History:[]`,
    };

    constructor(private _dimensions: Dimensions) {
        super();

        // TODO: We want to deserialize properties only for the first instance
        // TODO: of Terminal for the application.
        this.deserialize();
        this.history = History;

        this.on("job", this.serialize.bind(this));

        this.clearJobs();
    }

    createJob(): void {
        const job = new Job(this);

        job.once("end", () => {
            if (app.dock && !_.some(browserWindow.getAllWindows(), window => window.isFocused())) {
                app.dock.bounce("informational");
                const smiley = job.status === Status.Success ? "1" : "✕";
                app.dock.setBadge(smiley);
            }
            this.createJob();
        });

        this.jobs = this.jobs.concat(job);
        this.emit("job");
    }

    get dimensions(): Dimensions {
        return this._dimensions;
    }

    set dimensions(value: Dimensions) {
        this._dimensions = value;
        this.jobs.forEach(job => job.winch());
    }

    clearJobs(): void {
        this.jobs = [];
        this.createJob();
    }
{'fraction_non_alphanumeric': 0.1320185614849188, 'fraction_numerical': 0.0002320185614849188, 'mean_word_length': 2.628787878787879, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 13, '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': '6368248', 'n_tokens_mistral': 1194, 'n_tokens_neox': 1138, 'n_words': 326}