<commit_before>require 'libxml'
require 'openssl'
require 'base64'

class String
  def camel_up
    self.split('_').map(&:capitalize).join('')
  end
end

module GoogleApps
  module Atom
    include LibXML

    HASH_FUNCTION = "SHA-1"
    DOCUMENTS = %w(user export group group_member message_attributes public_key feed)

    NAMESPACES = {
      atom: 'http://www.w3.org/2005/Atom',
      apps: 'http://schemas.google.com/apps/2006',
      gd: 'http://schemas.google.com/g/2005',
      openSearch: 'http://a9.com/-/spec/opensearchrss/1.0/'
    }

    MAPS = {
      user: {
        userName: :login,
        suspended: :suspended,
        familyName: :last_name,
        givenName: :first_name
      }
    }

    ENTRY_TAG = ["<atom:entry xmlns:atom=\"#{NAMESPACES[:atom]}\" xmlns:apps=\"#{NAMESPACES[:apps]}\" xmlns:gd=\"#{NAMESPACES[:gd]}\">", '</atom:entry>']

    # The idea is to make document distribution more dynamic.
    # Might be pointless but it's here for now.
    DOCUMENTS.each do |doc|
      eval "def #{doc}(*args)\n  #{doc.camel_up}.new *args\nend" # Needs __file__ and __line__
      module_function doc.to_sym
    end
  end
end<commit_msg>Added nickname map<commit_after>require 'libxml'
require 'openssl'
require 'base64'

class String
  def camel_up
    self.split('_').map(&:capitalize).join('')
  end
end

module GoogleApps
  module Atom
    include LibXML

    HASH_FUNCTION = "SHA-1"
    DOCUMENTS = %w(user export group group_member message_attributes public_key feed)

    NAMESPACES = {
      atom: 'http://www.w3.org/2005/Atom',
      apps: 'http://schemas.google.com/apps/2006',
      gd: 'http://schemas.google.com/g/2005',
      openSearch: 'http://a9.com/-/spec/opensearchrss/1.0/'
    }

    MAPS = {
      user: {
        userName: :login,
        suspended: :suspended,
        familyName: :last_name,
        givenName: :first_name
      },
      nickname: {
        name: :nickname,
        userName: :user
      }
    }

    ENTRY_TAG = ["<atom:entry xmlns:atom=\"#{NAMESPACES[:atom]}\" xmlns:apps=\"#{NAMESPACES[:apps]}\" xmlns:gd=\"#{NAMESPACES[:gd]}\">", '</atom:entry>']

    # The idea is to make document distribution more dynamic.
    # Might be pointless but it's here for now.
    DOCUMENTS.each do |doc|
      eval "def #{doc}(*args)\n  #{doc.camel_up}.new *args\nend" # Needs __file__ and __line__
      module_function doc.to_sym
    end
  end
end
{'fraction_non_alphanumeric': 0.1504793664026678, 'fraction_numerical': 0.015839933305543976, 'mean_word_length': 2.8095238095238093, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 8}, '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': '2985346', 'n_tokens_mistral': 894, 'n_tokens_neox': 830, 'n_words': 182}