<commit_before>import * as _ from "lodash";
import * as i from "./Interfaces";
import * as React from "react";
import Session from "./Session";
import ANSIParser from "./ANSIParser";
import Prompt from "./Prompt";
import Buffer from "./Buffer";
import CommandExecutor from "./CommandExecutor";
import PTY from "./PTY";
import PluginManager from "./PluginManager";
import EmitterWithUniqueID from "./EmitterWithUniqueID";
import {Status} from "./Enums";
import Environment from "./Environment";
import {convertKeyCode} from "./utils/Common";

function makeThrottledDataEmitter(timesPerSecond: number, subject: EmitterWithUniqueID) {
    return _.throttle(() => subject.emit("data"), 1000 / timesPerSecond);
}

export default class Job extends EmitterWithUniqueID {
    public command: PTY;
    public parser: ANSIParser;
    public status: Status = Status.NotStarted;
    private _prompt: Prompt;
    private _buffer: Buffer;
    private rareDataEmitter: Function;
    private frequentDataEmitter: Function;

    constructor(private _session: Session) {
        super();

        this._prompt = new Prompt(this);
        this._prompt.on("send", () => this.execute());

        this.rareDataEmitter = makeThrottledDataEmitter(1, this);
        this.frequentDataEmitter = makeThrottledDataEmitter(60, this);

        this._buffer = new Buffer(this.dimensions);
        this._buffer.on("data", this.throttledDataEmitter);
        this.parser = new ANSIParser(this);
    }
<commit_msg>Add some readonly signatures for fun.<commit_after>import * as _ from "lodash";
import * as i from "./Interfaces";
import * as React from "react";
import Session from "./Session";
import ANSIParser from "./ANSIParser";
import Prompt from "./Prompt";
import Buffer from "./Buffer";
import CommandExecutor from "./CommandExecutor";
import PTY from "./PTY";
import PluginManager from "./PluginManager";
import EmitterWithUniqueID from "./EmitterWithUniqueID";
import {Status} from "./Enums";
import Environment from "./Environment";
import {convertKeyCode} from "./utils/Common";

function makeThrottledDataEmitter(timesPerSecond: number, subject: EmitterWithUniqueID) {
    return _.throttle(() => subject.emit("data"), 1000 / timesPerSecond);
}

export default class Job extends EmitterWithUniqueID {
    public command: PTY;
    public status: Status = Status.NotStarted;
    public readonly parser: ANSIParser;
    private readonly _prompt: Prompt;
    private readonly _buffer: Buffer;
    private readonly rareDataEmitter: Function;
    private readonly frequentDataEmitter: Function;

    constructor(private _session: Session) {
        super();

        this._prompt = new Prompt(this);
        this._prompt.on("send", () => this.execute());

        this.rareDataEmitter = makeThrottledDataEmitter(1, this);
        this.frequentDataEmitter = makeThrottledDataEmitter(60, this);

        this._buffer = new Buffer(this.dimensions);
        this._buffer.on("data", this.throttledDataEmitter);
        this.parser = new ANSIParser(this);
    }

{'fraction_non_alphanumeric': 0.11654011224826676, 'fraction_numerical': 0.00462198745460548, 'mean_word_length': 4.135593220338983, 'pattern_counts': {'":': 0, '<': 3, '<?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': '1136747', 'n_tokens_mistral': 862, 'n_tokens_neox': 838, 'n_words': 248}