<commit_before>﻿/// <reference path="_references.ts" />

var clc = require('cli-color'),
    backgroundStyle = clc.bgWhite,
    labelStyle = clc.yellow.italic,
    progressStyle = clc.blue.bold,
    percentstyle = clc.green.italic;

class ProgressBar {
    private __visibleArray: Array<string> = new Array<string>(10);
    private __percent: number = 0;
    private __progressBarLength: number = 0;
    private __drawCount = 0;

    constructor(public label: string = 'Progress',
        public format: string = ':label :bar :percent',
        private __output: NodeJS.WritableStream = process.stdout) { }

    update(completeCount: number, totalCount: number) {
        this.__percent = (completeCount / totalCount);
        this.__progressBarLength = Math.floor((this.__percent * 10));
        this.__draw();
    }

    private __draw() {
        if (this.__drawCount < 1) {
            this.__output.write('\r\n');
        }
        (<any>process.stdout).cursorTo(0);
        //(<any>process.stdout).clearLine(1);

        for (var i = 0; i < this.__progressBarLength; i++) {
            this.__visibleArray[i] = '=';
        }

        process.stdout.write(this.__formatText());
        this.__drawCount++;
    }

    private __formatText(): string {
        var toRtn = this.format;

        toRtn = toRtn.replace(':label', labelStyle(this.label));
        toRtn = toRtn.replace(':bar', backgroundStyle(progressStyle(this.__visibleArray.join(''))));
        toRtn = toRtn.replace(':percent', percentstyle(Math.floor((this.__percent * 100)) + ' %'));

        return toRtn;
    }

}

export = ProgressBar;<commit_msg>Removed commented code.<commit_after>﻿/// <reference path="_references.ts" />

var clc = require('cli-color'),
    backgroundStyle = clc.bgWhite,
    labelStyle = clc.yellow.italic,
    progressStyle = clc.blue.bold,
    percentstyle = clc.green.italic;

class ProgressBar {
    private __visibleArray: Array<string> = new Array<string>(10);
    private __percent: number = 0;
    private __progressBarLength: number = 0;
    private __drawCount = 0;

    constructor(public label: string = 'Progress',
        public format: string = ':label :bar :percent',
        private __output: NodeJS.WritableStream = process.stdout) { }

    update(completeCount: number, totalCount: number) {
        this.__percent = (completeCount / totalCount);
        this.__progressBarLength = Math.floor((this.__percent * 10));
        this.__draw();
    }

    private __draw() {
        if (this.__drawCount < 1) {
            this.__output.write('\r\n');
        }
        (<any>process.stdout).cursorTo(0);

        for (var i = 0; i < this.__progressBarLength; i++) {
            this.__visibleArray[i] = '=';
        }

        process.stdout.write(this.__formatText());
        this.__drawCount++;
    }

    private __formatText(): string {
        var toRtn = this.format;

        toRtn = toRtn.replace(':label', labelStyle(this.label));
        toRtn = toRtn.replace(':bar', backgroundStyle(progressStyle(this.__visibleArray.join(''))));
        toRtn = toRtn.replace(':percent', percentstyle(Math.floor((this.__percent * 100)) + ' %'));

        return toRtn;
    }

}

export = ProgressBar;
{'fraction_non_alphanumeric': 0.14463840399002495, 'fraction_numerical': 0.00841645885286783, 'mean_word_length': 2.8066429418742587, 'pattern_counts': {'":': 0, '<': 16, '<?xml version=': 0, '>': 12, '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': '1241917', 'n_tokens_mistral': 1000, 'n_tokens_neox': 955, 'n_words': 190}