<commit_before>require_relative 'external_source_presenter'
require_relative 'permission_presenter'
require_relative 'user_table_presenter'

module Carto
  module Api
    class VisualizationPresenter

      def initialize(visualization, current_viewer, context,
                     related: true, related_canonical_visualizations: false, show_user: false,
                     show_stats: true, show_table: true, show_liked: true,
                     show_permission: true, show_synchronization: true, show_uses_builder_features: true,
                     show_table_size_and_row_count: true, show_auth_tokens: true, show_user_basemaps: false,
                     password: <PASSWORD>, with_dependent_visualizations: 0)
        @visualization = visualization
        @current_viewer = current_viewer
        @context = context

        @related = related
        @load_related_canonical_visualizations = related_canonical_visualizations
        @show_user = show_user
        @show_stats = show_stats
        @show_liked = show_liked
        @show_table = show_table
        @show_permission = show_permission
        @show_synchronization = show_synchronization
        @show_uses_builder_features = show_uses_builder_features
        @show_table_size_and_row_count = show_table_size_and_row_count
        @show_auth_tokens = show_auth_tokens
        @show_user_basemaps = show_user_basemaps
        @password = password
        @with_dependent_visualizations = with_dependent_visualizations

        @presenter_cache = Carto::Api::PresenterCache.new
      end

      def with_presenter_cache(presenter_cache)
        @presenter_cache = presenter_cache
        self
      end

      def to_poro
        return_private_poro = @visualization.can_view_private_info?(@current_viewer)

        poro = return_private_poro ? to_private_poro : to_public_poro
<commit_msg>cache presenter_cache<commit_after>require_relative 'external_source_presenter'
require_relative 'permission_presenter'
require_relative 'user_table_presenter'

module Carto
  module Api
    class VisualizationPresenter

      ALLOWED_PARAMS = [:related, :related_canonical_visualizations, :show_user,
                        :show_stats, :show_table, :show_liked,
                        :show_permission, :show_synchronization, :show_uses_builder_features,
                        :show_table_size_and_row_count, :show_auth_tokens, :show_user_basemaps,
                        :password, :with_dependent_visualizations].freeze

      def initialize(visualization, current_viewer, context,
                     related: true, related_canonical_visualizations: false, show_user: false,
                     show_stats: true, show_table: true, show_liked: true,
                     show_permission: true, show_synchronization: true, show_uses_builder_features: true,
                     show_table_size_and_row_count: true, show_auth_tokens: true, show_user_basemaps: false,
                     password: <PASSWORD>, with_dependent_visualizations: 0)
        @visualization = visualization
        @current_viewer = current_viewer
        @context = context

        @related = related
        @load_related_canonical_visualizations = related_canonical_visualizations
        @show_user = show_user
        @show_stats = show_stats
        @show_liked = show_liked
        @show_table = show_table
        @show_permission = show_permission
        @show_synchronization = show_synchronization
        @show_uses_builder_features = show_uses_builder_features
        @show_table_size_and_row_count = show_table_size_and_row_count
        @show_auth_tokens = show_auth_tokens
        @show_user_basemaps = show_user_basemaps
        @password = password
        @with_dependent_visualizations = with_dependent_visualizations

        @presenter_cache ||= Carto::Api::PresenterCache.new
      end

      def with_presenter_cache(presenter_cache)
        @presenter_cache = presenter_cache
        self
      end

      def to_poro
        return_private_poro = @visualization.can_view_private_info?(@current_viewer)

        poro = return_private_poro ? to_private_poro : to_public_poro

{'fraction_non_alphanumeric': 0.055114320096269556, 'fraction_numerical': 0.0004813477737665463, 'mean_word_length': 3.114851485148515, 'pattern_counts': {'":': 0, '<': 5, '<?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': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4934507', 'n_tokens_mistral': 1213, 'n_tokens_neox': 1149, 'n_words': 206}