<commit_before># encoding: utf-8

module Nanoc3::DataSources

  # Nanoc3::DataSources::Delicious provides for a delicious.com bookmarks from
  # a single user as items (Nanoc3::Item instances).
  #
  # The configuration must have a "username" attribute containing the username
  # of the account from which to fetch the bookmarks.
  class Delicious < Nanoc3::DataSource

    def items
      @items ||= begin
        # Get data
        @http_client ||= Nanoc3::Extra::CachingHTTPClient.new
        data = @http_client.get("http://feeds.delicious.com/v2/json/#{self.config[:username]}")

        # Parse as JSON
        require 'json'
        raw_items = JSON.parse(data)

        # Convert to items
        raw_items.enum_with_index.map do |raw_item, i|
          # Get data
          content = raw_item['n']
          attributes = {
            :url         => raw_item['u'],
            :description => raw_item['d'],
            :tags        => raw_item['t'],
            :date        => raw_item['dt'],
            :note        => raw_item['n'],
            :author      => raw_item['a']
          }
          identifier = File.join(self.root, i.to_s)
          mtime = nil

          # Build item
          Nanoc3::Item.new(content, attributes, identifier, mtime)
        end
      end
    end

  end

end<commit_msg>made delicious data source return timestamp as Time instead of String<commit_after># encoding: utf-8

module Nanoc3::DataSources

  # Nanoc3::DataSources::Delicious provides for a delicious.com bookmarks from
  # a single user as items (Nanoc3::Item instances).
  #
  # The configuration must have a "username" attribute containing the username
  # of the account from which to fetch the bookmarks.
  class Delicious < Nanoc3::DataSource

    def items
      @items ||= begin
        # Get data
        @http_client ||= Nanoc3::Extra::CachingHTTPClient.new
        data = @http_client.get("http://feeds.delicious.com/v2/json/#{self.config[:username]}")

        # Parse as JSON
        require 'json'
        raw_items = JSON.parse(data)

        # Convert to items
        raw_items.enum_with_index.map do |raw_item, i|
          # Get data
          content = raw_item['n']
          attributes = {
            :url         => raw_item['u'],
            :description => raw_item['d'],
            :tags        => raw_item['t'],
            :date        => Time.parse(raw_item['dt']),
            :note        => raw_item['n'],
            :author      => raw_item['a']
          }
          identifier = File.join(self.root, i.to_s)
          mtime = nil

          # Build item
          Nanoc3::Item.new(content, attributes, identifier, mtime)
        end
      end
    end

  end

end
{'fraction_non_alphanumeric': 0.11254612546125461, 'fraction_numerical': 0.005904059040590406, 'mean_word_length': 2.005543237250554, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 15, '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': '3935736', 'n_tokens_mistral': 802, 'n_tokens_neox': 777, 'n_words': 205}