<commit_before>import 'dart:async';
import 'package:vane/vane.dart';
import 'package:mongo_dart/mongo_dart.dart';

String collectionName = "posts";

class GetAllPosts extends Vane {
  Future main() {
    mongodb.open().then((c) {
      DbCollection coll = mongodb.collection(collectionName);
      coll.find().toList().then((data) {
        log.info(data);
        close(data);
      }).catchError((e) {
        log.warning(e);
        close(new List());
      });
    }).catchError((e) {
      log.warning(e);
      close(new List());
    });
    
   return end;
  }
}

class SavePost extends Vane {
  Future main() {
    mongodb.open().then((c) {
      DbCollection coll = mongodb.collection(collectionName);
      coll.insert({"name": json["name"], "message": json["message"]}).then((data) {
        log.info(data);
        close("Added post: $json");
      }).catchError((e) {
        log.warning(e);
        close("Unable to save post");
      });
    }).catchError((e) {
      log.warning(e);
      close("Unable to save post");
    });
    
    return end;
  }
}

class DeletePosts extends Vane {
  Future main() {
    mongodb.open().then((c) {
      DbCollection coll = mongodb.collection(collectionName);
      coll.remove().then((data) {
        log.info(data);
        close("Removed ${data["n"]} posts");
      }).catchError((e) {
        log.warning(e);
        close("Unable to delete posts");
      });
    }).catchError((e) {
      log.warning(e);
      close("Unable to delete posts");
    });
    
    return end;
  }
}<commit_msg>Updated to the latest version of Vane<commit_after>import 'dart:async';
import 'package:vane/vane.dart';

String collectionName = "posts";

class GetAllPosts extends Vane {
  Future main() {
    mongodb.then((mongodb) {
      var coll = mongodb.collection(collectionName);
      coll.find().toList().then((data) {
        log.info(data.toString());
        close(data);
      }).catchError((e) {
        log.warning(e.toString());
        close(new List());
      });
    }).catchError((e) {
      log.warning(e.toString());
      close(new List());
    });
    
   return end;
  }
}

class SavePost extends Vane {
  Future main() {
    mongodb.then((mongodb) {
      var coll = mongodb.collection(collectionName);
      coll.insert({"name": json["name"], "message": json["message"]}).then((data) {
        log.info(data.toString());
        close("Added post: $json");
      }).catchError((e) {
        log.warning(e.toString());
        close("Unable to save post");
      });
    }).catchError((e) {
      log.warning(e.toString());
      close("Unable to save post");
    });
    
    return end;
  }
}

class DeletePosts extends Vane {
  Future main() {
    mongodb.then((mongodb) {
      var coll = mongodb.collection(collectionName);
      coll.remove().then((data) {
        log.info(data.toString());
        close("Removed ${data["n"]} posts");
      }).catchError((e) {
        log.warning(e.toString());
        close("Unable to delete posts");
      });
    }).catchError((e) {
      log.warning(e.toString());
      close("Unable to delete posts");
    });
    
    return end;
  }
}

{'fraction_non_alphanumeric': 0.17858277724817287, 'fraction_numerical': 0.0, 'mean_word_length': 2.513392857142857, 'pattern_counts': {'":': 4, '<': 3, '<?xml version=': 0, '>': 3, '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': '6679938', 'n_tokens_mistral': 1009, 'n_tokens_neox': 985, 'n_words': 190}