<commit_before>part of mongo_dart;

class WriteConcern { 
  static const ERRORS_IGNORED = const WriteConcern._(-1);   
  static const UNACKNOWLEDGED = const WriteConcern._(0); 
  static const ACKNOWLEDGED = const WriteConcern._(1); 
  static const JOURNALED = const WriteConcern._(2);  
  const WriteConcern._(this.value); 
  final int value; 
} 


class Db{
  String databaseName;
  ServerConfig serverConfig;
  Connection connection;
  WriteConcern _writeConcern;
  _validateDatabaseName(String dbName) {
    if(dbName.length == 0) throw "database name cannot be the empty string";
    var invalidChars = [" ", ".", "\$", "/", "\\"];
    for(var i = 0; i < invalidChars.length; i++) {
      if(dbName.indexOf(invalidChars[i]) != -1) throw new Exception("database names cannot contain the character '${invalidChars[i]}'");
    }
  }

/**
* Db constructor expects [valid mongodb URI] (http://www.mongodb.org/display/DOCS/Connections).
* For example next code points to local mongodb server on default mongodb port, database *testdb*
*     var db = new Db('mongodb://127.0.0.1/testdb');
* And that code direct to MongoLab server on 37637 port, database *testdb*, username *dart*, password *<PASSWORD>*
*     var db = new Db('mongodb://dart:test@ds037637-a.mongolab.com:37637/objectory_blog');
*/
  Db(String uriString){
    _configureConsoleLogger();
    var uri = Uri.parse(uriString);
    if (uri.scheme != 'mongodb') {
      throw 'Invalid scheme in uri: $uriString ${uri.scheme}';
    }
    serverConfig = new ServerConfig();
    serverConfig.host = uri.domain;
    serverConfig.port = uri.port;
    if (serverConfig.port == null || serverConfig.port == 0){
      serverConfig.port = 27017;
    }
    if (uri.userInfo != '') {
      var userInfo = uri.userInfo.split(':');
      if (userInfo.length != 2) {
        throw 'Неверный формат поля userInfo: $uri.userInfo';
      }
      serverConfig.userName = userInfo[0];
      serverConfig.password = userInfo[1];
    }
    if (uri.path != '') {
      databaseName = uri.path.replaceAll('/','');
    }<commit_msg>uri domain was renamed to host in the language<commit_after>part of mongo_dart;

class WriteConcern { 
  static const ERRORS_IGNORED = const WriteConcern._(-1);   
  static const UNACKNOWLEDGED = const WriteConcern._(0); 
  static const ACKNOWLEDGED = const WriteConcern._(1); 
  static const JOURNALED = const WriteConcern._(2);  
  const WriteConcern._(this.value); 
  final int value; 
} 


class Db{
  String databaseName;
  ServerConfig serverConfig;
  Connection connection;
  WriteConcern _writeConcern;
  _validateDatabaseName(String dbName) {
    if(dbName.length == 0) throw "database name cannot be the empty string";
    var invalidChars = [" ", ".", "\$", "/", "\\"];
    for(var i = 0; i < invalidChars.length; i++) {
      if(dbName.indexOf(invalidChars[i]) != -1) throw new Exception("database names cannot contain the character '${invalidChars[i]}'");
    }
  }

/**
* Db constructor expects [valid mongodb URI] (http://www.mongodb.org/display/DOCS/Connections).
* For example next code points to local mongodb server on default mongodb port, database *testdb*
*     var db = new Db('mongodb://127.0.0.1/testdb');
* And that code direct to MongoLab server on 37637 port, database *testdb*, username *dart*, password *<PASSWORD>*
*     var db = new Db('mongodb://dart:<PASSWORD>@ds<EMAIL>:37637/objectory_blog');
*/
  Db(String uriString){
    _configureConsoleLogger();
    var uri = Uri.parse(uriString);
    if (uri.scheme != 'mongodb') {
      throw 'Invalid scheme in uri: $uriString ${uri.scheme}';
    }
    serverConfig = new ServerConfig();
    serverConfig.host = uri.host;
    serverConfig.port = uri.port;
    if (serverConfig.port == null || serverConfig.port == 0){
      serverConfig.port = 27017;
    }
    if (uri.userInfo != '') {
      var userInfo = uri.userInfo.split(':');
      if (userInfo.length != 2) {
        throw 'Неверный формат поля userInfo: $uri.userInfo';
      }
      serverConfig.userName = userInfo[0];
      serverConfig.password = userInfo[1];
    }
    if (uri.path != '') {
      databaseName = uri.path.replaceAll('/','');
    }
{'fraction_non_alphanumeric': 0.14038044786901036, 'fraction_numerical': 0.01685528533590176, 'mean_word_length': 3.4570815450643777, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 3, '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': '1040195', 'n_tokens_mistral': 1422, 'n_tokens_neox': 1315, 'n_words': 350}