<commit_before>module Authentication
  unless defined? CONSTANTS_DEFINED
    # Uncomment to suit
    RE_LOGIN_OK     = /\A\w[\w\.\-_@]+\z/                     # ASCII, strict
    # RE_LOGIN_OK   = /\A[[:alnum:]][[:alnum:]\.\-_@]+\z/     # Unicode, strict
    # RE_LOGIN_OK   = /\A[^[:cntrl:]\\<>\/&]*\z/              # Unicode, permissive
    MSG_LOGIN_BAD   = "use only letters, numbers, and .-_@ please."

    RE_NAME_OK      = /\A[^[:cntrl:]\\<>\/&]*\z/              # Unicode, permissive
    MSG_NAME_BAD    = "avoid non-printing characters and \\&gt;&lt;&amp;/ please."

    # This is purposefully imperfect -- it's just a check for bogus input. See
    # http://www.regular-expressions.info/email.html
    RE_EMAIL_NAME   = '[\w\.%\+\-]+'                          # what you actually see in practice
    #RE_EMAIL_NAME   = '0-9A-Z!#\$%\&\'\*\+_/=\?^\-`\{|\}~\.' # technically allowed by RFC-2822
    RE_DOMAIN_HEAD  = '(?:[A-Z0-9\-]+\.)+'
    RE_DOMAIN_TLD   = '(?:[A-Z]{2}|com|org|net|gov|mil|biz|info|mobi|name|aero|jobs|museum)'
    RE_EMAIL_OK     = /\A#{RE_EMAIL_NAME}@#{RE_DOMAIN_HEAD}#{RE_DOMAIN_TLD}\z/i
    MSG_EMAIL_BAD   = "should look like an email address."
    
    CONSTANTS_DEFINED = 'yup' # sorry for the C idiom
  end
  
  def self.included( recipient )
    recipient.extend( ModelClassMethods )
    recipient.class_eval do
      include ModelInstanceMethods
    end
  end

  module ModelClassMethods
    def secure_digest(*args)
      Digest::SHA1.hexdigest(args.flatten.join('--'))
    end
    def make_token
      secure_digest(Time.now, (1..10).map{ rand.to_s })
    end 
  end # class methods
  
  module ModelInstanceMethods
  end # instance methods

end
<commit_msg>.edu are people too<commit_after>module Authentication
  unless defined? CONSTANTS_DEFINED
    # Uncomment to suit
    RE_LOGIN_OK     = /\A\w[\w\.\-_@]+\z/                     # ASCII, strict
    # RE_LOGIN_OK   = /\A[[:alnum:]][[:alnum:]\.\-_@]+\z/     # Unicode, strict
    # RE_LOGIN_OK   = /\A[^[:cntrl:]\\<>\/&]*\z/              # Unicode, permissive
    MSG_LOGIN_BAD   = "use only letters, numbers, and .-_@ please."

    RE_NAME_OK      = /\A[^[:cntrl:]\\<>\/&]*\z/              # Unicode, permissive
    MSG_NAME_BAD    = "avoid non-printing characters and \\&gt;&lt;&amp;/ please."

    # This is purposefully imperfect -- it's just a check for bogus input. See
    # http://www.regular-expressions.info/email.html
    RE_EMAIL_NAME   = '[\w\.%\+\-]+'                          # what you actually see in practice
    #RE_EMAIL_NAME   = '0-9A-Z!#\$%\&\'\*\+_/=\?^\-`\{|\}~\.' # technically allowed by RFC-2822
    RE_DOMAIN_HEAD  = '(?:[A-Z0-9\-]+\.)+'
    RE_DOMAIN_TLD   = '(?:[A-Z]{2}|com|org|net|edu|gov|mil|biz|info|mobi|name|aero|jobs|museum)'
    RE_EMAIL_OK     = /\A#{RE_EMAIL_NAME}@#{RE_DOMAIN_HEAD}#{RE_DOMAIN_TLD}\z/i
    MSG_EMAIL_BAD   = "should look like an email address."
    
    CONSTANTS_DEFINED = 'yup' # sorry for the C idiom
  end
  
  def self.included( recipient )
    recipient.extend( ModelClassMethods )
    recipient.class_eval do
      include ModelInstanceMethods
    end
  end

  module ModelClassMethods
    def secure_digest(*args)
      Digest::SHA1.hexdigest(args.flatten.join('--'))
    end
    def make_token
      secure_digest(Time.now, (1..10).map{ rand.to_s })
    end 
  end # class methods
  
  module ModelInstanceMethods
  end # instance methods

end

{'fraction_non_alphanumeric': 0.16686251468860164, 'fraction_numerical': 0.00763807285546416, 'mean_word_length': 2.4084084084084085, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '5409555', 'n_tokens_mistral': 1322, 'n_tokens_neox': 1243, 'n_words': 239}