<commit_before>module Sisimai::Bite::JSON
  # Sisimai::Bite::JSON::SendGrid parses a bounce object(JSON) which created by
  # SendGrid. Methods in the module are called from only Sisimai::Message.
  module SendGrid
    # Imported from p5-Sisimail/lib/Sisimai/Bite/JSON/SendGrid.pm
    class << self
      require 'sisimai/bite/json'

      def smtpagent;   return Sisimai::Bite.smtpagent(self); end
      def description; return 'SendGrid(JSON): http://sendgrid.com/'; end

      # @abstract Adapt SendGrid bounce object for Sisimai::Message format
      # @param        [Hash] argvs  bounce object(JSON) retrieved from SendGrid API
      # @return       [Hash, Nil]   Bounce data list and message/rfc822 part
      #                             or Undef if it failed to parse or the
      #                             arguments are missing
      # @since v4.20.0
      def adapt(argvs)
        return nil unless argvs.is_a? Hash
        return nil unless argvs.keys.size > 0
        return nil unless argvs.key?('email')
        return nil unless Sisimai::RFC5322.is_emailaddress(argvs['email'])

        dscontents = [Sisimai::Bite.DELIVERYSTATUS]
        rfc822head = {}     # (Hash) Check flags for headers in RFC822 part
        v = dscontents[-1]

        require 'sisimai/string'
        require 'sisimai/address'<commit_msg>Fix code: Lint/UselessAssignment<commit_after>module Sisimai::Bite::JSON
  # Sisimai::Bite::JSON::SendGrid parses a bounce object(JSON) which created by
  # SendGrid. Methods in the module are called from only Sisimai::Message.
  module SendGrid
    # Imported from p5-Sisimail/lib/Sisimai/Bite/JSON/SendGrid.pm
    class << self
      require 'sisimai/bite/json'

      def smtpagent;   return Sisimai::Bite.smtpagent(self); end
      def description; return 'SendGrid(JSON): http://sendgrid.com/'; end

      # @abstract Adapt SendGrid bounce object for Sisimai::Message format
      # @param        [Hash] argvs  bounce object(JSON) retrieved from SendGrid API
      # @return       [Hash, Nil]   Bounce data list and message/rfc822 part
      #                             or Undef if it failed to parse or the
      #                             arguments are missing
      # @since v4.20.0
      def adapt(argvs)
        return nil unless argvs.is_a? Hash
        return nil unless argvs.keys.size > 0
        return nil unless argvs.key?('email')
        return nil unless Sisimai::RFC5322.is_emailaddress(argvs['email'])

        dscontents = [Sisimai::Bite.DELIVERYSTATUS]
        v = dscontents[-1]

        require 'sisimai/string'
        require 'sisimai/address'
{'fraction_non_alphanumeric': 0.09045611345343044, 'fraction_numerical': 0.013031812955155231, 'mean_word_length': 2.4523809523809526, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5304152', 'n_tokens_mistral': 832, 'n_tokens_neox': 797, 'n_words': 226}