<commit_before>require 'chef/project'
require 'chef/version'
require 'digest'

class Chef
  class ProjectCache
    attr_reader :project
    attr_reader :metadata_dir

    def initialize(project, metadata_dir)
      @project = project
      @metadata_dir = metadata_dir
    end

    # This method ensures that we do not have i686 as architecture in manifests.
    # We are not supposed to have it anyways but maybe some older version of
    # projects still has it.
    def fix_windows_manifest!(manifest)
      return manifest if manifest['windows'].nil?

      builds_32bit = {}
      builds_64bit = {}

      manifest['windows'].each do |platform_version, build_data|
        build_data.each do |architecture, builds|
          builds.each do |version, build|
            case architecture
            when 'x86_64'
              builds_64bit[version] = build

              # Prior to 12.6.0 we have sometimes posted some windows builds
              # only for x86_64. We need to make sure these builds are also
              # distributed for i386 since prior to 12.6.0 we only had a single
              # windows build that works for all platforms.
              if Opscode::Version.parse(version) <= Opscode::Version.parse("12.6.0")
                builds_32bit[version] = build
              end
            when 'i386', 'i686'
              builds_32bit[version] = build
            else
              raise "Unknown Windows architecture '#{architecture}'"
            end
          end
        end
      end

      manifest['windows'] = {
        '2008r2' => {
          'i386'   => builds_32bit,
          'x86_64' => builds_64bit
        }
      }

      manifest
    end<commit_msg>Modify s3_poller to make 32bit builds for chefdk the same as 64 bit builds<commit_after>require 'chef/project'
require 'chef/version'
require 'digest'

class Chef
  class ProjectCache
    attr_reader :project
    attr_reader :metadata_dir

    def initialize(project, metadata_dir)
      @project = project
      @metadata_dir = metadata_dir
    end

    # This method ensures that we do not have i686 as architecture in manifests.
    # We are not supposed to have it anyways but maybe some older version of
    # projects still has it.
    def fix_windows_manifest!(manifest)
      return manifest if manifest['windows'].nil?

      builds_32bit = {}
      builds_64bit = {}

      manifest['windows'].each do |platform_version, build_data|
        build_data.each do |architecture, builds|
          builds.each do |version, build|
            case architecture
            when 'x86_64'
              builds_64bit[version] = build

              # Prior to 12.6.0 we have sometimes posted some windows builds
              # only for x86_64. We need to make sure these builds are also
              # distributed for i386 since prior to 12.6.0 we only had a single
              # windows build that works for all platforms.
              if Opscode::Version.parse(version) <= Opscode::Version.parse("12.6.0")
                builds_32bit[version] = build
              end
            when 'i386', 'i686'
              builds_32bit[version] = build
              if project.name == 'chefdk'
                builds_64bit[version] = build
              end
            else
              raise "Unknown Windows architecture '#{architecture}'"
            end
          end
        end
      end

      manifest['windows'] = {
        '2008r2' => {
          'i386'   => builds_32bit,
          'x86_64' => builds_64bit
        }
      }

      manifest
    end
{'fraction_non_alphanumeric': 0.07361618432143861, 'fraction_numerical': 0.03456026973869064, 'mean_word_length': 1.9348722176422093, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 9, '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': '6782629', 'n_tokens_mistral': 1036, 'n_tokens_neox': 950, 'n_words': 316}