<commit_before>'use strict';
var assert = require('assert')

function pad(n) {
  return n < 10 ? '0' + n : n
}

function date2string(d) {
  return d.getUTCFullYear() + '-'
  + pad(d.getUTCMonth() + 1) + '-'
  + pad(d.getUTCDate()) + 'T'
  + pad(d.getUTCHours()) + ':'
  + pad(d.getUTCMinutes()) + ':'
  + pad(d.getUTCSeconds()) + 'Z'
}


function ATOMWriter(writer) {
  if (!(this instanceof ATOMWriter)) {
    return new ATOMWriter(writer);
  }
  assert.equal(typeof writer, 'object')

  this.writer = writer

}

ATOMWriter.prototype = {
  flush: function () {
    this.writer.flush()
    return this
  },
  startFeed: function (id, updated, created) {
    if (updated === undefined) {
      updated = new Date()
    }
    assert.equal(typeof id, 'string')
    assert(updated instanceof Date)
    this.writer.startElement('feed')
    this.writer.writeAttribute('xmlns', 'http://www.w3.org/2005/Atom')
    this.writer.writeAttribute('xmlns:opensearch', 'http://a9.com/-/spec/opensearch/1.1/')
    this.writer.writeElement('id', id)
    if (created instanceof Date) {
      this.writer.writeElement('created', date2string(created))
    }
    this.writer.writeElement('updated', date2string(updated))
    return this
  },
  writeTitle: function (value, type, lang) {
    if (type === undefined) {
      type = 'text'
    }
    assert.equal(typeof value, 'string')
    assert.equal(typeof type, 'string')
    this.writer.startElement('title')
    this.writer.writeAttribute('type', type)
    if (typeof lang === 'string') {
      this.writer.writeAttribute('xml:lang', lang)
    }
    this.writer.text(value)
    this.writer.endElement()
    return this
  },
  writeLink: function (value, type, rel) {
    if (type === undefined) {
      type = 'text/html'
    }
    assert.equal(typeof value, 'string')
    assert.equal(typeof type, 'string')
    this.writer.startElement('link')
    this.writer.writeAttribute('type', type)
    this.writer.writeAttribute('href', value)
    if (rel !== undefined) {
      this.writer.writeAttribute('rel', rel)
    }
    this.writer.endElement()
    return this
  },
  writeAuthor: function (name, email, uri) {
    this.writer.startElement('author')
    if (typeof name === 'string') {
      this.writer.writeElement('name', name)
    }
    if (typeof email === 'string') {
      this.writer.writeElement('email', email)
    }
    if (typeof uri === 'string') {
      this.writer.writeElement('uri', uri)
    }
    this.writer.endElement()
    return this
  },
  writeAuthorRAW: function (string) {
    assert.equal(typeof string, 'string')
    var email, author, index = string.search(/@/)
    if (index) {
      email = string
      author = string.substr(0, index)
    }
    else {
      email = null
      author = string
    }
    return this.writeAuthor(author, email)
  },
  writeContributor: function (name, email, uri) {
    assert.equal(typeof name, 'string')
    this.writer.startElement('contributor');
    if (typeof name === 'string') {
      this.writer.writeElement('name', name)
    }
    if (typeof email === 'string') {
      this.writer.writeElement('email', email)
    }
    if (typeof uri === 'string') {
      this.writer.writeElement('uri', uri)
    }
    this.writer.endElement()
    return this
  },
  writeCategory: function (term, scheme, label) {
    assert.equal(typeof term, 'string')<commit_msg>Fixed writeAuthorRAW not detecting a '@' properly<commit_after>'use strict';
var assert = require('assert')

function pad(n) {
  return n < 10 ? '0' + n : n
}

function date2string(d) {
  return d.getUTCFullYear() + '-'
  + pad(d.getUTCMonth() + 1) + '-'
  + pad(d.getUTCDate()) + 'T'
  + pad(d.getUTCHours()) + ':'
  + pad(d.getUTCMinutes()) + ':'
  + pad(d.getUTCSeconds()) + 'Z'
}


function ATOMWriter(writer) {
  if (!(this instanceof ATOMWriter)) {
    return new ATOMWriter(writer);
  }
  assert.equal(typeof writer, 'object')

  this.writer = writer

}

ATOMWriter.prototype = {
  flush: function () {
    this.writer.flush()
    return this
  },
  startFeed: function (id, updated, created) {
    if (updated === undefined) {
      updated = new Date()
    }
    assert.equal(typeof id, 'string')
    assert(updated instanceof Date)
    this.writer.startElement('feed')
    this.writer.writeAttribute('xmlns', 'http://www.w3.org/2005/Atom')
    this.writer.writeAttribute('xmlns:opensearch', 'http://a9.com/-/spec/opensearch/1.1/')
    this.writer.writeElement('id', id)
    if (created instanceof Date) {
      this.writer.writeElement('created', date2string(created))
    }
    this.writer.writeElement('updated', date2string(updated))
    return this
  },
  writeTitle: function (value, type, lang) {
    if (type === undefined) {
      type = 'text'
    }
    assert.equal(typeof value, 'string')
    assert.equal(typeof type, 'string')
    this.writer.startElement('title')
    this.writer.writeAttribute('type', type)
    if (typeof lang === 'string') {
      this.writer.writeAttribute('xml:lang', lang)
    }
    this.writer.text(value)
    this.writer.endElement()
    return this
  },
  writeLink: function (value, type, rel) {
    if (type === undefined) {
      type = 'text/html'
    }
    assert.equal(typeof value, 'string')
    assert.equal(typeof type, 'string')
    this.writer.startElement('link')
    this.writer.writeAttribute('type', type)
    this.writer.writeAttribute('href', value)
    if (rel !== undefined) {
      this.writer.writeAttribute('rel', rel)
    }
    this.writer.endElement()
    return this
  },
  writeAuthor: function (name, email, uri) {
    this.writer.startElement('author')
    if (typeof name === 'string') {
      this.writer.writeElement('name', name)
    }
    if (typeof email === 'string') {
      this.writer.writeElement('email', email)
    }
    if (typeof uri === 'string') {
      this.writer.writeElement('uri', uri)
    }
    this.writer.endElement()
    return this
  },
  writeAuthorRAW: function (string) {
    assert.equal(typeof string, 'string')
    var email, author, index = string.search(/@/)
    if (index !== -1) {
      email = string
      author = string.substr(0, index)
    }
    else {
      email = null
      author = string
    }
    return this.writeAuthor(author, email)
  },
  writeContributor: function (name, email, uri) {
    assert.equal(typeof name, 'string')
    this.writer.startElement('contributor');
    if (typeof name === 'string') {
      this.writer.writeElement('name', name)
    }
    if (typeof email === 'string') {
      this.writer.writeElement('email', email)
    }
    if (typeof uri === 'string') {
      this.writer.writeElement('uri', uri)
    }
    this.writer.endElement()
    return this
  },
  writeCategory: function (term, scheme, label) {
    assert.equal(typeof term, 'string')
{'fraction_non_alphanumeric': 0.16102321454975602, 'fraction_numerical': 0.004879491349992607, 'mean_word_length': 3.0600240096038416, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 6}, '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': '7204259', 'n_tokens_mistral': 2199, 'n_tokens_neox': 2178, 'n_words': 461}