<commit_before>

function Ws2pMessage(message) {

  var that = this;

  var parts = message.split(':');
  if (parts.length < 3 || !parts[0].startsWith('WS2P')) {
    throw Error('Invalid format: ' + message);
  }
  // Head message
  if (parts[1] == 'HEAD') {
    if (parts.length < 4) {
      throw Error('Invalid format: ' + message);
    }
    // Duniter version < 1.6.9
    if (parts.length == 4) {
      that.pubkey = parts[2];
      that.buid = parts[3];
    }
    else {
      var version = parts[2];
      if (version >= 1) {
        var prefix = parts[0];

        // Private/public options
        if (prefix.length > 4) {
          var matches = this.regexp.WS2P_PREFIX.exec(prefix);
          if (!matches) {
            throw Error('Invalid format: ' + message);
          }

          // Private options
          var privateOptions = matches[1];
          if (privateOptions) {
            that.private = {
              useTor: privateOptions.startsWith('T')
            };
            var mode = privateOptions.substring(1);
            if (mode == 'A') {
              that.private.mode = 'all';
            }
            else if (mode == 'M') {
              that.private.mode = 'mixed';
            }
            else if (mode == 'S') {
              that.private.mode = 'strict';
            }
          }

          // Public options
          var publicOptions = matches[2];
          if (publicOptions) {
            that.public = {
              useTor: publicOptions.startsWith('T'),
              mode: 'all'
            };
          }

          // For DEBUG only:
          console.log('[http] private {0}, public {1}'.format(
           (that.private.useTor ? 'TOR ' : '' ) + (that.private.mode || 'false'),
            (that.public.useTor ? 'TOR ' : '' ) + (that.public.mode || 'false')
          ), prefix);
        }

        that.pubkey=parts[3];
        that.buid=parts[4];
        that.ws2pid=parts[5];
        that.sotfware=parts[6];
        that.version=parts[7];
        that.powPrefix=parts[8];
      }
    }
  }

}


Ws2pMessage.prototype.regexp = {
  WS2P_PREFIX: /^WS2P(?:O([CT][SAM]))?(?:I([CT]))?$/,
};

<commit_msg>[fix] Fix console debug message<commit_after>

function Ws2pMessage(message) {

  var that = this;

  var parts = message.split(':');
  if (parts.length < 3 || !parts[0].startsWith('WS2P')) {
    throw Error('Invalid format: ' + message);
  }
  // Head message
  if (parts[1] == 'HEAD') {
    if (parts.length < 4) {
      throw Error('Invalid format: ' + message);
    }
    // Duniter version < 1.6.9
    if (parts.length == 4) {
      that.pubkey = parts[2];
      that.buid = parts[3];
    }
    else {
      var version = parts[2];
      if (version >= 1) {
        var prefix = parts[0];

        // Private/public options
        if (prefix.length > 4) {
          var matches = this.regexp.WS2P_PREFIX.exec(prefix);
          if (!matches) {
            throw Error('Invalid format: ' + message);
          }

          // Private options
          var privateOptions = matches[1];
          if (privateOptions) {
            that.private = {
              useTor: privateOptions.startsWith('T')
            };
            var mode = privateOptions.substring(1);
            if (mode == 'A') {
              that.private.mode = 'all';
            }
            else if (mode == 'M') {
              that.private.mode = 'mixed';
            }
            else if (mode == 'S') {
              that.private.mode = 'strict';
            }
          }

          // Public options
          var publicOptions = matches[2];
          if (publicOptions) {
            that.public = {
              useTor: publicOptions.startsWith('T'),
              mode: 'all'
            };
          }

          // For DEBUG only:
          /*
          console.log('[http] private {0}, public {1}'.format(
           (that.private && (that.private.useTor ? 'TOR ' : '' ) + (that.private.mode || 'false')) || 'false',
            that.public && ((that.public.useTor ? 'TOR ' : '' ) + (that.public.mode || 'false')) || 'false'
          ), prefix);*/
        }

        that.pubkey=parts[3];
        that.buid=parts[4];
        that.ws2pid=parts[5];
        that.sotfware=parts[6];
        that.version=parts[7];
        that.powPrefix=parts[8];
      }
    }
  }

}


Ws2pMessage.prototype.regexp = {
  WS2P_PREFIX: /^WS2P(?:O([CT][SAM]))?(?:I([CT]))?$/,
};


{'fraction_non_alphanumeric': 0.1619047619047619, 'fraction_numerical': 0.014512471655328799, 'mean_word_length': 1.573512252042007, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 7, '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': '338846', 'n_tokens_mistral': 1398, 'n_tokens_neox': 1361, 'n_words': 270}