<commit_before>module Pod
  # The Dependency allows to specify dependencies of a {Podfile} or a
  # {Specification} on a Pod. It stores the name of the dependency, version
  # requirements and external sources information.
  #
  # This class is based on the dependency class of RubyGems and mimics its
  # implementation with adjustments specific to CocoaPods. RubyGems is
  # available under the
  # [MIT license](https://github.com/rubygems/rubygems/blob/master/MIT.txt).
  #
  class Dependency
    # @return [String] The name of the Pod described by this dependency.
    #
    attr_accessor :name

    # @return [Hash{Symbol=>String}] a hash describing the external source
    #         where the pod should be fetched. The external source has to
    #         provide its own {Specification} file.
    #
    attr_accessor :external_source

    # @return [String] The source URL of the podspec repo to use to resolve
    #         this dependency. If not set then the standard source list
    #         should be used to resolve the dependency.
    attr_accessor :podspec_repo

    # @overload   initialize(name, requirements)
    #
    #   @param    [String] name
    #             the name of the Pod.
    #
    #   @param    [Array, Version, String, Requirement] requirements
    #             an array specifying the version requirements of the
    #             dependency.
    #
    #   @example  Initialization with version requirements.
    #
    #             Dependency.new('AFNetworking')
    #             Dependency.new('AFNetworking', '~> 1.0')
    #             Dependency.new('AFNetworking', '>= 0.5', '< 0.7')
    #
    # @overload   initialize(name, external_source)
    #
    #   @param    [String] name
    #             the name of the Pod.
    #
    #   @param    [Hash] external_source
    #             a hash describing the external source.
    #
    #   @example  Initialization with an external source.
    #
    #             Dependency.new('libPusher', {:git     => 'example.com/repo.git'})
    #             Dependency.new('libPusher', {:path    => 'path/to/folder'})
    #             Dependency.new('libPusher', {:podspec => 'example.com/libPusher.podspec'})
    #
    # @overload   initialize(name, requirements, podspec_repo)
    #
    #   @param    [String] name
    #             the name of the Pod.
    #
    #   @param    [Array, Version, String, Requirement] requirements
    #             an array specifying the version requirements of the
    #             dependency.
    #
    #   @param    [Hash] podspec_repo
    #             The URL of the specific podspec repo to resolve this dependency from.
    #
    #   @example  Initialization with a specific podspec repo
    #
    #             Dependency.new('Artsy+UILabels', '~> 1.0', :source => 'https://github.com/Artsy/Specs.git')
    #
    # @overload   initialize(name, is_head)
    #
    #   @param    [String] name
    #             the name of the Pod.
    #
    #   @param    [Symbol] is_head
    #             a symbol that can be `:head` or nil.
    #
    #   @todo     Remove once everyone has migrated past CocoaPods 1.0.
    #
    #   @example  Initialization with the head option
    #
    #             Dependency.new('RestKit', :head)
    #
    def initialize(name = nil, *requirements)
      if requirements.last.is_a?(Hash)
        additional_params = requirements.pop.select { |_, v| !v.nil? }
        additional_params = nil if additional_params.empty?

        if additional_params && @podspec_repo = additional_params[:source]
          # This dependency specifies the exact source podspec repo to use.
          additional_params.delete(:source)
          unless additional_params.empty?
            raise Informative, 'A dependency with a specified podspec repo may ' \
              "not include other source parameters (#{name})."
          end
        else
          @external_source = additional_params
          unless requirements.empty?
            raise Informative, 'A dependency with an external source may not ' \
              "specify version requirements (#{name})."
          end
        end

      elsif requirements.last == :head
        raise Informative, '`:head` dependencies have been removed. Please use ' \
          "normal external source dependencies instead of `:head` for `#{name}`."
      end

      if requirements.length == 1 && requirements.first.is_a?(Requirement)
        requirements = requirements.first
      end
      @name = name
      @requirement = Requirement.create(requirements)
    end

    # @return [Version] whether the dependency points to a specific version.
    #
    attr_accessor :specific_version

    # @return [Requirement] the requirement of this dependency (a set of
    #         one or more version restrictions).
    #<commit_msg>[Dependency] Make :head error more helpful<commit_after>module Pod
  # The Dependency allows to specify dependencies of a {Podfile} or a
  # {Specification} on a Pod. It stores the name of the dependency, version
  # requirements and external sources information.
  #
  # This class is based on the dependency class of RubyGems and mimics its
  # implementation with adjustments specific to CocoaPods. RubyGems is
  # available under the
  # [MIT license](https://github.com/rubygems/rubygems/blob/master/MIT.txt).
  #
  class Dependency
    # @return [String] The name of the Pod described by this dependency.
    #
    attr_accessor :name

    # @return [Hash{Symbol=>String}] a hash describing the external source
    #         where the pod should be fetched. The external source has to
    #         provide its own {Specification} file.
    #
    attr_accessor :external_source

    # @return [String] The source URL of the podspec repo to use to resolve
    #         this dependency. If not set then the standard source list
    #         should be used to resolve the dependency.
    attr_accessor :podspec_repo

    # @overload   initialize(name, requirements)
    #
    #   @param    [String] name
    #             the name of the Pod.
    #
    #   @param    [Array, Version, String, Requirement] requirements
    #             an array specifying the version requirements of the
    #             dependency.
    #
    #   @example  Initialization with version requirements.
    #
    #             Dependency.new('AFNetworking')
    #             Dependency.new('AFNetworking', '~> 1.0')
    #             Dependency.new('AFNetworking', '>= 0.5', '< 0.7')
    #
    # @overload   initialize(name, external_source)
    #
    #   @param    [String] name
    #             the name of the Pod.
    #
    #   @param    [Hash] external_source
    #             a hash describing the external source.
    #
    #   @example  Initialization with an external source.
    #
    #             Dependency.new('libPusher', {:git     => 'example.com/repo.git'})
    #             Dependency.new('libPusher', {:path    => 'path/to/folder'})
    #             Dependency.new('libPusher', {:podspec => 'example.com/libPusher.podspec'})
    #
    # @overload   initialize(name, requirements, podspec_repo)
    #
    #   @param    [String] name
    #             the name of the Pod.
    #
    #   @param    [Array, Version, String, Requirement] requirements
    #             an array specifying the version requirements of the
    #             dependency.
    #
    #   @param    [Hash] podspec_repo
    #             The URL of the specific podspec repo to resolve this dependency from.
    #
    #   @example  Initialization with a specific podspec repo
    #
    #             Dependency.new('Artsy+UILabels', '~> 1.0', :source => 'https://github.com/Artsy/Specs.git')
    #
    # @overload   initialize(name, is_head)
    #
    #   @param    [String] name
    #             the name of the Pod.
    #
    #   @param    [Symbol] is_head
    #             a symbol that can be `:head` or nil.
    #
    #   @todo     Remove `:head` code once everyone has migrated past CocoaPods 1.0.
    #
    #   @example  Initialization with the head option
    #
    #             Dependency.new('RestKit', :head)
    #
    def initialize(name = nil, *requirements)
      if requirements.last.is_a?(Hash)
        additional_params = requirements.pop.select { |_, v| !v.nil? }
        additional_params = nil if additional_params.empty?

        if additional_params && @podspec_repo = additional_params[:source]
          # This dependency specifies the exact source podspec repo to use.
          additional_params.delete(:source)
          unless additional_params.empty?
            raise Informative, 'A dependency with a specified podspec repo may ' \
              "not include other source parameters (#{name})."
          end
        else
          @external_source = additional_params
          unless requirements.empty?
            raise Informative, 'A dependency with an external source may not ' \
              "specify version requirements (#{name})."
          end
        end

      elsif requirements.last == :head
        raise Informative, '`:head` dependencies have been removed. Please use ' \
          "normal external source dependencies (`:git => 'GIT_REPO_URL'`) " \
          "instead of `:head` for `#{name}`."
      end

      if requirements.length == 1 && requirements.first.is_a?(Requirement)
        requirements = requirements.first
      end
      @name = name
      @requirement = Requirement.create(requirements)
    end

    # @return [Version] whether the dependency points to a specific version.
    #
    attr_accessor :specific_version

    # @return [Requirement] the requirement of this dependency (a set of
    #         one or more version restrictions).
    #
{'fraction_non_alphanumeric': 0.09104016477857879, 'fraction_numerical': 0.0022657054582904223, 'mean_word_length': 2.136627906976744, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 20, 'https://': 4, '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': '3808500', 'n_tokens_mistral': 2709, 'n_tokens_neox': 2631, 'n_words': 855}