<commit_before>module SmartAnswer::Calculators
  class RegisterADeathCalculator
    include ActiveModel::Model

    attr_accessor :location_of_death
    attr_accessor :death_location_type
    attr_accessor :death_expected
    attr_accessor :country_of_death
    attr_accessor :current_location
    attr_accessor :current_country

    def initialize(attributes = {})
      super
      @reg_data_query = RegistrationsDataQuery.new
      @country_name_query = CountryNameFormatter.new
      @translator_query = TranslatorLinks.new
    end

    def died_in_uk?
      %w(england_wales scotland northern_ireland).include?(location_of_death)
    end

    def died_at_home_or_in_hospital?
      death_location_type == 'at_home_hospital'
    end

    def death_expected?
      death_expected == 'yes'
    end

    def registration_country
      @reg_data_query.registration_country_slug(current_country || country_of_death)
    end

    def registration_country_name_lowercase_prefix
      @country_name_query.definitive_article(registration_country)
    end

    def death_country_name_lowercase_prefix
      @country_name_query.definitive_article(country_of_death)
    end

    def country_has_no_embassy?
      %w(iran libya syria yemen).include?(country_of_death)
    end

    def responded_with_commonwealth_country?
      RegistrationsDataQuery::COMMONWEALTH_COUNTRIES.include?(country_of_death)
    end

    def in_the_uk?
      current_location == 'in_the_uk'
    end

    def same_country?
      current_location == 'same_country'
    end

    def another_country?
      current_location == 'another_country'
    end

    def died_in_north_korea?
      country_of_death == 'north-korea'
    end

    def currently_in_north_korea?
      # TODO: current_country == 'north-korea'
      nil == 'north-korea'
    end

    def translator_link_url
      @translator_query.links[country_of_death]
    end

    def overseas_passports_embassies
      location = WorldLocation.find(registration_country)
      raise InvalidResponse unless location
      organisation = location.fco_organisation

      if organisation
        organisation.offices_with_service 'Births and Deaths registration service'
      else
        []
      end
    end
  end
end
<commit_msg>Don't raise InvalidResponse in overseas_passports_embassies method<commit_after>module SmartAnswer::Calculators
  class RegisterADeathCalculator
    include ActiveModel::Model

    attr_accessor :location_of_death
    attr_accessor :death_location_type
    attr_accessor :death_expected
    attr_accessor :country_of_death
    attr_accessor :current_location
    attr_accessor :current_country

    def initialize(attributes = {})
      super
      @reg_data_query = RegistrationsDataQuery.new
      @country_name_query = CountryNameFormatter.new
      @translator_query = TranslatorLinks.new
    end

    def died_in_uk?
      %w(england_wales scotland northern_ireland).include?(location_of_death)
    end

    def died_at_home_or_in_hospital?
      death_location_type == 'at_home_hospital'
    end

    def death_expected?
      death_expected == 'yes'
    end

    def registration_country
      @reg_data_query.registration_country_slug(current_country || country_of_death)
    end

    def registration_country_name_lowercase_prefix
      @country_name_query.definitive_article(registration_country)
    end

    def death_country_name_lowercase_prefix
      @country_name_query.definitive_article(country_of_death)
    end

    def country_has_no_embassy?
      %w(iran libya syria yemen).include?(country_of_death)
    end

    def responded_with_commonwealth_country?
      RegistrationsDataQuery::COMMONWEALTH_COUNTRIES.include?(country_of_death)
    end

    def in_the_uk?
      current_location == 'in_the_uk'
    end

    def same_country?
      current_location == 'same_country'
    end

    def another_country?
      current_location == 'another_country'
    end

    def died_in_north_korea?
      country_of_death == 'north-korea'
    end

    def currently_in_north_korea?
      # TODO: current_country == 'north-korea'
      nil == 'north-korea'
    end

    def translator_link_url
      @translator_query.links[country_of_death]
    end

    def overseas_passports_embassies
      location = WorldLocation.find(registration_country)
      organisation = location.fco_organisation

      if organisation
        organisation.offices_with_service 'Births and Deaths registration service'
      else
        []
      end
    end
  end
end

{'fraction_non_alphanumeric': 0.054730777753157545, 'fraction_numerical': 0.0, 'mean_word_length': 3.523046092184369, 'pattern_counts': {'":': 0, '<': 3, '<?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': '529610', 'n_tokens_mistral': 1459, 'n_tokens_neox': 1371, 'n_words': 247}