<commit_before>require "fog/core/model"

module Fog
  module Compute
    class Brkt
      class ComputingCell < Fog::Model
        identity :id

        attribute :name
        attribute :description
        attribute :provider
        attribute :gateway_ip
        attribute :provider_options, :aliases => ["provider_computing_cell", :provider_computing_cell]

        has_one :network, :networks

        def initialize(options={})
          self.provider = "AWS"
          self.provider_options = {}
          self.network = Network.new(:service => options[:service])
          super
        end

        def save
          requires :name, :provider, :network, :provider_options
          if provider_options.empty?
            raise ArgumentError.new("missing provider_options is required for this operation")
          end
          if network.cidr_block.nil? or network.cidr_block.empty?
            raise ArgumentError.new("missing network.cidr_block is required for this operation")
          end

          data = service.create_computing_cell(name, network.cidr_block, provider,
            provider_options, attributes).body
          merge_attributes(data)
          true
        end

        def destroy
          requires :id

          service.delete_computing_cell(id)
          true
        end

        def zones
          network.zones
        end

        def network=(new_network)
          if network && new_network.is_a?(Hash)
            network.merge_attributes(new_network)
          else
            associations[:network] = new_network
          end
        end

        def completely_deleted?
          begin
            reload
            false
          rescue
            true
          end
        end
      end
    end
  end
end
<commit_msg>Catch particular 404 exception<commit_after>require "fog/core/model"

module Fog
  module Compute
    class Brkt
      class ComputingCell < Fog::Model
        identity :id

        attribute :name
        attribute :description
        attribute :provider
        attribute :gateway_ip
        attribute :provider_options, :aliases => ["provider_computing_cell", :provider_computing_cell]

        has_one :network, :networks

        def initialize(options={})
          self.provider = "AWS"
          self.provider_options = {}
          self.network = Network.new(:service => options[:service])
          super
        end

        def save
          requires :name, :provider, :network, :provider_options
          if provider_options.empty?
            raise ArgumentError.new("missing provider_options is required for this operation")
          end
          if network.cidr_block.nil? or network.cidr_block.empty?
            raise ArgumentError.new("missing network.cidr_block is required for this operation")
          end

          data = service.create_computing_cell(name, network.cidr_block, provider,
            provider_options, attributes).body
          merge_attributes(data)
          true
        end

        def destroy
          requires :id

          service.delete_computing_cell(id)
          true
        end

        def zones
          network.zones
        end

        def network=(new_network)
          if network && new_network.is_a?(Hash)
            network.merge_attributes(new_network)
          else
            associations[:network] = new_network
          end
        end

        def completely_deleted?
          begin
            reload
            false
          rescue Excon::Errors::NotFound
            true
          end
        end
      end
    end
  end
end

{'fraction_non_alphanumeric': 0.064013359309769, 'fraction_numerical': 0.0008349568605622043, 'mean_word_length': 1.7624903920061492, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, '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': '3622177', 'n_tokens_mistral': 912, 'n_tokens_neox': 898, 'n_words': 232}