<commit_before>module Travis
  module Services
    module Requests
      class Receive
        class PullRequest
          attr_reader :event

          def initialize(event)
            @event = event
          end

          def accept?
            return false if disabled?
            case action
            when :opened, :reopened then !!merge_commit
            when :synchronize       then head_change?
            else false
            end
          end

          def disabled?
            Travis::Features.feature_deactivated?(:pull_requests)
          end

          def head_change?
            head_commit && Request.last_by_head_commit(head_commit['sha']).nil?
          end

          def repository
            @repository ||= {
              :name        => repo['name'],
              :description => repo['description'],
              :url         => repo['_links']['html']['href'],
              :owner_type  => repo_owner['type'],
              :owner_name  => repo_owner['login'],
              :owner_email => repo_owner['email'],
              :private     => !!repo['private']
            }
          end

          def owner
            @owner ||= {
              :type  => repo_owner['type'],
              :login => repo_owner['login']
            }
          end

          def admin
            @admin ||= begin
              repo = Repository.where(owner_name: repository['owner_name'], name: repository['name']).first
              repo.admin
            end
          end

          def request<commit_msg>remove admin from pull request payload<commit_after>module Travis
  module Services
    module Requests
      class Receive
        class PullRequest
          attr_reader :event

          def initialize(event)
            @event = event
          end

          def accept?
            return false if disabled?
            case action
            when :opened, :reopened then !!merge_commit
            when :synchronize       then head_change?
            else false
            end
          end

          def disabled?
            Travis::Features.feature_deactivated?(:pull_requests)
          end

          def head_change?
            head_commit && Request.last_by_head_commit(head_commit['sha']).nil?
          end

          def repository
            @repository ||= {
              :name        => repo['name'],
              :description => repo['description'],
              :url         => repo['_links']['html']['href'],
              :owner_type  => repo_owner['type'],
              :owner_name  => repo_owner['login'],
              :owner_email => repo_owner['email'],
              :private     => !!repo['private']
            }
          end

          def owner
            @owner ||= {
              :type  => repo_owner['type'],
              :login => repo_owner['login']
            }
          end

          # def admin
          #   @admin ||= begin
          #     repo = Repository.where(owner_name: repository['owner_name'], name: repository['name']).first
          #     repo.admin
          #   end
          # end

          def request
{'fraction_non_alphanumeric': 0.09810836806668805, 'fraction_numerical': 0.0, 'mean_word_length': 1.3388305847076463, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 21, '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': '5320271', 'n_tokens_mistral': 762, 'n_tokens_neox': 739, 'n_words': 178}