<commit_before>part of mongo_dart;

class CursorStream extends Stream<Map> {
  final Cursor cursor;
  Stream<Map> _source;
  StreamSubscription<Map> _subscription;
  StreamController<Map> _controller;

  CursorStream(Stream<Map> source, this.cursor) : _source = source {
    _controller = new StreamController<Map>(
        onListen: _onListen,
        onPause: _onPause,
        onResume: _onResume,
        onCancel: _onCancel);
  }

  StreamSubscription<Map> listen(void onData(Map line),
                                    {Function onError,
                                    void onDone(),
                                    bool cancelOnError }) {
    return _controller.stream.listen(onData,
    onError: onError,
    onDone: onDone,
    cancelOnError: cancelOnError);
  }
  void _onError(error) {
    _controller.addError(error);
  }
  void _onListen() {
    _subscription = _source.listen(_onData,
    onError: _controller.addError,
    onDone: _onDone);
  }

  void _onCancel() {
    _subscription.cancel();
    _subscription = null;
  }

  void _onPause() {
    _subscription.pause();
  }

  void _onResume() {
    _subscription.resume();
  }

  void _onData(Map input) {
//    List<String> splits = input.split('\n');
//    splits[0] = _remainder + splits[0];
//    _remainder = splits.removeLast();
//    _lineCount += splits.length;
//    splits.forEach(_controller.add);
    _controller.add(input);
  }<commit_msg>remove unised method<commit_after>part of mongo_dart;

class CursorStream extends Stream<Map> {
  final Cursor cursor;
  Stream<Map> _source;
  StreamSubscription<Map> _subscription;
  StreamController<Map> _controller;

  CursorStream(Stream<Map> source, this.cursor) : _source = source {
    _controller = new StreamController<Map>(
        onListen: _onListen,
        onPause: _onPause,
        onResume: _onResume,
        onCancel: _onCancel);
  }

  StreamSubscription<Map> listen(void onData(Map line),
                                    {Function onError,
                                    void onDone(),
                                    bool cancelOnError }) {
    return _controller.stream.listen(onData,
    onError: onError,
    onDone: onDone,
    cancelOnError: cancelOnError);
  }

  void _onListen() {
    _subscription = _source.listen(_onData,
    onError: _controller.addError,
    onDone: _onDone);
  }

  void _onCancel() {
    _subscription.cancel();
    _subscription = null;
  }

  void _onPause() {
    _subscription.pause();
  }

  void _onResume() {
    _subscription.resume();
  }

  void _onData(Map input) {
//    List<String> splits = input.split('\n');
//    splits[0] = _remainder + splits[0];
//    _remainder = splits.removeLast();
//    _lineCount += splits.length;
//    splits.forEach(_controller.add);
    _controller.add(input);
  }
{'fraction_non_alphanumeric': 0.11308677098150782, 'fraction_numerical': 0.001422475106685633, 'mean_word_length': 2.5339195979899496, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 19, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 10, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7641306', 'n_tokens_mistral': 896, 'n_tokens_neox': 885, 'n_words': 173}