<commit_before># frozen_string_literal: true

module Qernel
  module NodeApi
    # Contains methods and attributes specific to querying molecule nodes.
    class MoleculeApi < Base
      dataset_accessors :output_capacity

      # Public: Calculates the number of units, based on the demand and input or output capacity.
      #
      # Returns a numeric.
      def number_of_units
        return 0.0 if demand.zero?

        if input_capacity&.positive?
          demand / input_capacity
        elsif output_capacity&.positive?
          (demand - output_of_loss) / output_capacity
        else
          super
        end
      end

      private

      # The input capacity of the molecule technology.
      #
      # Returns a numeric in kg.
      def input_capacity
        typical_input_capacity
      end
    end
  end
end<commit_msg>Molecule nodes have no CO2 cost<commit_after># frozen_string_literal: true

module Qernel
  module NodeApi
    # Contains methods and attributes specific to querying molecule nodes.
    class MoleculeApi < Base
      dataset_accessors :output_capacity

      # Public: Calculates the number of units, based on the demand and input or output capacity.
      #
      # Returns a numeric.
      def number_of_units
        return 0.0 if demand.zero?

        if input_capacity&.positive?
          demand / input_capacity
        elsif output_capacity&.positive?
          (demand - output_of_loss) / output_capacity
        else
          super
        end
      end

      # Public: The price of CO2 emissions by the node. Molecule nodes do not have CO2 emissions so
      # this is always zero.
      def co2_emissions_costs_per_typical_input
        0.0
      end

      private

      # The input capacity of the molecule technology.
      #
      # Returns a numeric in kg.
      def input_capacity
        typical_input_capacity
      end
    end
  end
end
{'fraction_non_alphanumeric': 0.03995793901156677, 'fraction_numerical': 0.005257623554153523, 'mean_word_length': 2.114566284779051, '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': '6190313', 'n_tokens_mistral': 528, 'n_tokens_neox': 500, 'n_words': 185}