<commit_before># Helpers for creating symbol upload scripts. This is meant to be ran after
# a packaging script
require "fileutils"
require 'uri'

# An extra dependency just for this script
require 'httparty'

require_relative 'RubyCommon.rb'

def checkRunFolder(suggested)

  buildFolder = File.join(suggested, "build", "Symbols")

  onError("Not ran from base folder (no build/Symbols directory exists)") if
    not File.exist?(buildFolder)

  buildFolder
end

def projectFolder(baseDir)

  File.expand_path File.join(baseDir, "../../")

end

def getExtraOptions(opts)

  opts.on("--token token", "Set to your API token") do |t|
    $options[:apiToken] = t
  end

  opts.on("--url url", "Override the default symbol destination") do |u|
    $options[:overrideURL] = u
  end

end

def extraHelp
  puts $extraParser
end

require_relative 'RubySetupSystem.rb'

if !$options[:apiToken]
  error "You must provide an API token (--token)"
  exit 2
end

# This object holds the configuration needed for making a release
class SymbolDestinationProperties

  attr_accessor :url

  def initialize(url)
    @url = url
  end
end


def findSymbolFiles(folder)

  symbols = []

  Dir.glob(File.join folder, "**/*"){|i|

    if !File.file? i
      next
    end

    begin

      platform, arch, hash, name = getBreakpadSymbolInfo File.read i

      if !platform || !arch || !hash || !name
        raise "not a breakpad file"
      end

      # Some extra sanity checks
      if name.count(' ') > 0 || (arch != "x86_64" && arch != "x86") ||
         (platform != "Linux" && platform != "Windows")
        puts "File properties: ", platform, arch, hash, name
        raise "file has invalid looking data"
      end      
      

    rescue
      warning "Invalid file: #{i}"
      next
    end

    symbols.push({
                   file: i,
                   platform: platform,
                   arch: arch,
                   hash: hash,
                   name: name,
                   size: File.size(i).to_f / 2**20
                 })
  }

  symbols
end
<commit_msg>Fixed uploader file detection for windows<commit_after># Helpers for creating symbol upload scripts. This is meant to be ran after
# a packaging script
require "fileutils"
require 'uri'

# An extra dependency just for this script
require 'httparty'

require_relative 'RubyCommon.rb'

def checkRunFolder(suggested)

  buildFolder = File.join(suggested, "build", "Symbols")

  onError("Not ran from base folder (no build/Symbols directory exists)") if
    not File.exist?(buildFolder)

  buildFolder
end

def projectFolder(baseDir)

  File.expand_path File.join(baseDir, "../../")

end

def getExtraOptions(opts)

  opts.on("--token token", "Set to your API token") do |t|
    $options[:apiToken] = t
  end

  opts.on("--url url", "Override the default symbol destination") do |u|
    $options[:overrideURL] = u
  end

end

def extraHelp
  puts $extraParser
end

require_relative 'RubySetupSystem.rb'

if !$options[:apiToken]
  error "You must provide an API token (--token)"
  exit 2
end

# This object holds the configuration needed for making a release
class SymbolDestinationProperties

  attr_accessor :url

  def initialize(url)
    @url = url
  end
end


def findSymbolFiles(folder)

  symbols = []

  Dir.glob(File.join folder, "**/*"){|i|

    if !File.file? i
      next
    end

    begin

      platform, arch, hash, name = getBreakpadSymbolInfo File.read i

      if !platform || !arch || !hash || !name
        raise "not a breakpad file"
      end

      # Some extra sanity checks
      # Not sure why some files have "unknown" as the arch on windows
      if name.count(' ') > 0 || (arch != "x86_64" && arch != "x86" && arch != "unknown") ||
         (platform != "Linux" && platform != "Windows" && platform != "windows")
        puts "File properties: ", platform, arch, hash, name
        raise "file has invalid looking data"
      end      
      

    rescue
      warning "Invalid file: #{i}"
      next
    end

    symbols.push({
                   file: i,
                   platform: platform,
                   arch: arch,
                   hash: hash,
                   name: name,
                   size: File.size(i).to_f / 2**20
                 })
  }

  symbols
end

{'fraction_non_alphanumeric': 0.10858348968105065, 'fraction_numerical': 0.005159474671669793, 'mean_word_length': 2.4312148028962186, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '759596', 'n_tokens_mistral': 1318, 'n_tokens_neox': 1253, 'n_words': 433}