<commit_before>part of cupid;

class Program {
  IoDevice _io;
  Shell _shell;

  Program() {
    this._io = new ConsoleIoDevice();
    this._shell = new Shell();
    _init();
  }

  Program.using(IoDevice this._io, Shell this._shell) {
    _init();
  }

  void _init() {
    reflectClass(this.runtimeType).declarations.forEach((k, v) {
      if (v.metadata.any((m) => m.reflectee is Command)) {
        addCommand(reflect(this).getField(k).reflectee);
      }
    });
  }

  ask(Question question) {

  }

  printInfo(String info) {

  }

  void addCommand(command) {
    _shell.addCommand(command);
  }

  Future execute(Symbol command) {
    return _zoned(() {
      return _shell.execute(command);
    });
  }

  Future waitForInput() async {
    return _zoned(() async {
      return _shell.input(await _io.input());
    });
  }

  Future _zoned(body()) {
    return runZoned(() {
      return body();
    }, zoneSpecification: new ZoneSpecification(
        print: (Zone self, ZoneDelegate parent, Zone zone, String line) {
          _io.output(line + '\n');
        }));
  }

  Future run() async {
    try {
      await waitForInput();
    } on InputException catch(e) {
      _io.outputInColor('<red>${e.toString()}</red>\n');
    } on ProgramExitingException {
      return;
    }
    await run();
  }

  void exit() {
    throw new ProgramExitingException();
  }
}

class ProgramExitingException {

}<commit_msg>A whole bunch of new stuff<commit_after>part of cupid;

class Program {
  IoDevice _io;
  Shell _shell;

  Program() {
    this._io = new ConsoleIoDevice();
    this._shell = new Shell();
  }

  Program.using(IoDevice this._io, Shell this._shell);

  Future init() async {
    reflectClass(this.runtimeType).declarations.forEach((k, v) {
      if (v.metadata.any((m) => m.reflectee is Command)) {
        addCommand(reflect(this).getField(k).reflectee);
      }
    });
    await setUp();
  }

  Future setUp() async {
  }

  Future tearDown() async {
  }

  ask(Question question) {

  }

  printInfo(String info) {

  }

  void addCommand(command) {
    _shell.addCommand(command);
  }

  Future execute(Symbol command) {
    return _zoned(() {
      return _shell.execute(command);
    });
  }

  Future waitForInput() async {
    return _zoned(() async {
      return _shell.input(await _io.input());
    });
  }

  Future _zoned(body()) {
    return runZoned(() {
      return body();
    }, zoneSpecification: new ZoneSpecification(
        print: (Zone self, ZoneDelegate parent, Zone zone, String line) {
          _io.output(line + '\n');
        }));
  }

  Future run() async {
    await setUp();
    await _runCycle();
    await tearDown();
  }

  Future _runCycle() async {
    try {
      await waitForInput();
    } on InputException catch(e) {
      _io.outputInColor('<red>${e.toString()}</red>\n');
    } on ProgramExitingException {
      return;
    }
    await _runCycle();
  }

  void exit() {
    throw new ProgramExitingException();
  }
}

class ProgramExitingException {

}
{'fraction_non_alphanumeric': 0.1420059582919563, 'fraction_numerical': 0.0, 'mean_word_length': 2.663030303030303, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 9, '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': '6029065', 'n_tokens_mistral': 1001, 'n_tokens_neox': 982, 'n_words': 215}