<commit_before>module Mutations
  class UpdateSiteView < BaseMutation
    field :site_view, Types::SiteViewType, null: true
    field :errors, [String], null: true

    argument :name, String, required: true
    argument :default, Boolean, required: true
    argument :url, String, required: true
    argument :description, String, required: false
    argument :id, Int, required: true
    argument :mutations, [Types::SiteViewMutationInputType], required: true

    def resolve(args)
      view = site_view(args[:id])
      view.attributes = {name:args[:name], default: args[:default], url: args[:url], description: args[:description]}
      mutations = args[:mutations].clone.map do |mutation|
        begin
          mutation[:payload] = JSON.parse(mutation[:payload])
        rescue StandardError # rubocop:disable Lint/HandleExceptions
          # use payload as string if it's not a json
        end
        mutation.to_h
      end<commit_msg>changed req's in update site view<commit_after>module Mutations
  class UpdateSiteView < BaseMutation
    field :site_view, Types::SiteViewType, null: true
    field :errors, [String], null: true

    argument :name, String, required: false
    argument :default, Boolean, required: false
    argument :url, String, required: false
    argument :description, String, required: false
    argument :id, Int, required: true
    argument :mutations, [Types::SiteViewMutationInputType], required: true

    def resolve(args)
      view = site_view(args[:id])
      view.attributes = {name:args[:name], default: args[:default], url: args[:url], description: args[:description]}
      mutations = args[:mutations].clone.map do |mutation|
        begin
          mutation[:payload] = JSON.parse(mutation[:payload])
        rescue StandardError # rubocop:disable Lint/HandleExceptions
          # use payload as string if it's not a json
        end
        mutation.to_h
      end
{'fraction_non_alphanumeric': 0.10359187922956793, 'fraction_numerical': 0.0, 'mean_word_length': 3.5545023696682465, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, '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': '1677304', 'n_tokens_mistral': 528, 'n_tokens_neox': 522, 'n_words': 164}