class Dependabot::Uv::FileUpdater::RequirementReplacer

def package_hashes_for(name:, version:, algorithm:)

def package_hashes_for(name:, version:, algorithm:)
  index_urls = @index_urls || [nil]
  index_urls.map do |index_url|
    args = [name, version, algorithm]
    args << index_url unless index_url.nil?
    begin
      result = SharedHelpers.run_helper_subprocess(
        command: "pyenv exec python3 #{NativeHelpers.python_helper_path}",
        function: "get_dependency_hash",
        args: args
      )
    rescue SharedHelpers::HelperSubprocessFailed => e
      requirement_error_handler(e)
      raise unless e.message.include?("PackageNotFoundError")
      next
    end
    return result.map { |h| "--hash=#{algorithm}:#{h['hash']}" } if result.is_a?(Array)
  end
  raise Dependabot::DependencyFileNotResolvable, "Unable to find hashes for package #{name}"
end