<commit_before># Sample script to install Python and pip under Windowsr
# Authors: <NAME>, <NAME> and <NAME>
# License: CC0 1.0 Universal: http://creativecommons.org/publicdomain/zero/1.0/r
r
$MINICONDA_URL = "http://repo.continuum.io/miniconda/"r
$BASE_URL = "https://www.python.org/ftp/python/"r
$GET_PIP_URL = "https://bootstrap.pypa.io/get-pip.py"r
$GET_PIP_PATH = "C:\get-pip.py"r
r
r
function DownloadPython ($python_version, $platform_suffix) {r
    $webclient = New-Object System.Net.WebClientr
    $filename = "python-" + $python_version + $platform_suffix + ".msi"r
    $url = $BASE_URL + $python_version + "/" + $filenamer
r
    $basedir = $pwd.Path + "\"r
    $filepath = $basedir + $filenamer
    if (Test-Path $filename) {r
        Write-Host "Reusing" $filepathr
        return $filepathr
    }r
r
    # Download and retry up to 3 times in case of network transient errors.r
    Write-Host "Downloading" $filename "from" $urlr
    $retry_attempts = 2r
    for($i=0; $i -lt $retry_attempts; $i++){r
        try {r
            $webclient.DownloadFile($url, $filepath)r
            breakr
        }r
        Catch [Exception]{r
            Start-Sleep 1r
        }r
   }r
   if (Test-Path $filepath) {r
       Write-Host "File saved at" $filepathr
   } else {r
       # Retry once to get the error message if any at the last tryr
       $webclient.DownloadFile($url, $filepath)r
   }r
   return $filepathr
}r
r
r
function InstallPython ($python_version, $architecture, $python_home) {r
    Write-Host "Installing Python" $python_version "for" $architecture "bit architecture to" $python_homer
    if (Test-Path $python_home) {r
        Write-Host $python_home "already exists, skipping."r
        return $falser
    }r
    if ($architecture -eq "32") {r
        $platform_suffix = ""r
    } else {r
        $platform_suffix = ".amd64"r
    }r
    $filepath = DownloadPython $python_version $platform_suffixr
    Write-Host "Installing" $filepath "to" $python_homer
    $install_log = $python_home + ".log"r
    $args = "/qn  /log $install_log /i $filepath TARGETDIR=$python_home"r
    Write-Host "msiexec.exe" $argsr
    Start-Process -FilePath "msiexec.exe" -ArgumentList $args -Wait -Passthrur
    if (Test-Path $python_home) {r
        Write-Host "Python $python_version ($architecture) installation complete"r
    } else {r
        Write-Host "Failed to install Python in $python_home"r
        Get-Content -Path $install_logr
        Exit 1r
    }r
}r
r
r
function InstallPip ($python_home) {r
    $pip_path = $python_home + "\Scripts\pip.exe"r
    $python_path = $python_home + "\python.exe"r
    if (-not(Test-Path $pip_path)) {r
        Write-Host "Installing pip..."r
        $webclient = New-Object System.Net.WebClientr
        $webclient.DownloadFile($GET_PIP_URL, $GET_PIP_PATH)r
        Write-Host "Executing:" $python_path $GET_PIP_PATHr
        Start-Process -FilePath "$python_path" -ArgumentList "$GET_PIP_PATH" -Wait -Passthrur
    } else {r
        Write-Host "pip already installed."r
    }r
}r
r
r
function DownloadMiniconda ($python_version, $platform_suffix) {r
    $webclient = New-Object System.Net.WebClientr
    if ($python_version -eq "3.4") {r
        $filename = "Miniconda3-3.5.5-Windows-" + $platform_suffix + ".exe"r
    } else {r
        $filename = "Miniconda-3.5.5-Windows-" + $platform_suffix + ".exe"r
    }r
    $url = $MINICONDA_URL + $filenamer
r
    $basedir = $pwd.Path + "\"r
    $filepath = $basedir + $filenamer
    if (Test-Path $filename) {r
        Write-Host "Reusing" $filepathr
        return $filepathr
    }r
r
    # Download and retry up to 3 times in case of network transient errors.r
    Write-Host "Downloading" $filename "from" $urlr
    $retry_attempts = 2r
    for($i=0; $i -lt $retry_attempts; $i++){r
        try {r
            $webclient.DownloadFile($url, $filepath)r
            breakr
        }r
        Catch [Exception]{r
            Start-Sleep 1r
        }r
   }r
   if (Test-Path $filepath) {r
       Write-Host "File saved at" $filepathr
   } else {r
       # Retry once to get the error message if any at the last tryr
       $webclient.DownloadFile($url, $filepath)r
   }r
   return $filepathr
}r
r
r
function InstallMiniconda ($python_version, $architecture, $python_home) {r
    Write-Host "Installing Python" $python_version "for" $architecture "bit architecture to" $python_homer
    if (Test-Path $python_home) {r
        Write-Host $python_home "already exists, skipping."r
        return $falser
    }r
    if ($architecture -eq "32") {r
        $platform_suffix = "x86"r
    } else {r
        $platform_suffix = "x86_64"r
    }r
    $filepath = DownloadMiniconda $python_version $platform_suffixr
    Write-Host "Installing" $filepath "to" $python_homer
    $install_log = $python_home + ".log"r
    $args = "/S /D=$python_home"r
    Write-Host $filepath $argsr
    Start-Process -FilePath $filepath -ArgumentList $args -Wait -Passthrur
    if (Test-Path $python_home) {r
        Write-Host "Python $python_version ($architecture) installation complete"r
    } else {r
        Write-Host "Failed to install Python in $python_home"r
        Get-Content -Path $install_logr
        Exit 1r
    }r
}r
r
r
function InstallMinicondaPip ($python_home) {r
    $pip_path = $python_home + "\Scripts\pip.exe"r
    $conda_path = $python_home + "\Scripts\conda.exe"r
    if (-not(Test-Path $pip_path)) {r
        Write-Host "Installing pip..."r
        $args = "install --yes pip"r
        Write-Host $conda_path $argsr
        Start-Process -FilePath "$conda_path" -ArgumentList $args -Wait -Passthrur
    } else {r
        Write-Host "pip already installed."r
    }r
}r
r
function main () {r
    InstallPython $env:PYTHON_VERSION $env:PYTHON_ARCH $env:PYTHONr
    InstallPip $env:PYTHONr
}r
r
mainr<commit_msg>Fix broken eol<commit_after># Sample script to install Python and pip under Windows
# Authors: <NAME>, <NAME> and <NAME>
# License: CC0 1.0 Universal: http://creativecommons.org/publicdomain/zero/1.0/

$MINICONDA_URL = "http://repo.continuum.io/miniconda/"
$BASE_URL = "https://www.python.org/ftp/python/"
$GET_PIP_URL = "https://bootstrap.pypa.io/get-pip.py"
$GET_PIP_PATH = "C:\get-pip.py"


function DownloadPython ($python_version, $platform_suffix) {
    $webclient = New-Object System.Net.WebClient
    $filename = "python-" + $python_version + $platform_suffix + ".msi"
    $url = $BASE_URL + $python_version + "/" + $filename

    $basedir = $pwd.Path + "\"
    $filepath = $basedir + $filename
    if (Test-Path $filename) {
        Write-Host "Reusing" $filepath
        return $filepath
    }

    # Download and retry up to 3 times in case of network transient errors.
    Write-Host "Downloading" $filename "from" $url
    $retry_attempts = 2
    for($i=0; $i -lt $retry_attempts; $i++){
        try {
            $webclient.DownloadFile($url, $filepath)
            break
        }
        Catch [Exception]{
            Start-Sleep 1
        }
   }
   if (Test-Path $filepath) {
       Write-Host "File saved at" $filepath
   } else {
       # Retry once to get the error message if any at the last try
       $webclient.DownloadFile($url, $filepath)
   }
   return $filepath
}


function InstallPython ($python_version, $architecture, $python_home) {
    Write-Host "Installing Python" $python_version "for" $architecture "bit architecture to" $python_home
    if (Test-Path $python_home) {
        Write-Host $python_home "already exists, skipping."
        return $false
    }
    if ($architecture -eq "32") {
        $platform_suffix = ""
    } else {
        $platform_suffix = ".amd64"
    }
    $filepath = DownloadPython $python_version $platform_suffix
    Write-Host "Installing" $filepath "to" $python_home
    $install_log = $python_home + ".log"
    $args = "/qn  /log $install_log /i $filepath TARGETDIR=$python_home"
    Write-Host "msiexec.exe" $args
    Start-Process -FilePath "msiexec.exe" -ArgumentList $args -Wait -Passthru
    if (Test-Path $python_home) {
        Write-Host "Python $python_version ($architecture) installation complete"
    } else {
        Write-Host "Failed to install Python in $python_home"
        Get-Content -Path $install_log
        Exit 1
    }
}


function InstallPip ($python_home) {
    $pip_path = $python_home + "\Scripts\pip.exe"
    $python_path = $python_home + "\python.exe"
    if (-not(Test-Path $pip_path)) {
        Write-Host "Installing pip..."
        $webclient = New-Object System.Net.WebClient
        $webclient.DownloadFile($GET_PIP_URL, $GET_PIP_PATH)
        Write-Host "Executing:" $python_path $GET_PIP_PATH
        Start-Process -FilePath "$python_path" -ArgumentList "$GET_PIP_PATH" -Wait -Passthru
    } else {
        Write-Host "pip already installed."
    }
}


function DownloadMiniconda ($python_version, $platform_suffix) {
    $webclient = New-Object System.Net.WebClient
    if ($python_version -eq "3.4") {
        $filename = "Miniconda3-3.5.5-Windows-" + $platform_suffix + ".exe"
    } else {
        $filename = "Miniconda-3.5.5-Windows-" + $platform_suffix + ".exe"
    }
    $url = $MINICONDA_URL + $filename

    $basedir = $pwd.Path + "\"
    $filepath = $basedir + $filename
    if (Test-Path $filename) {
        Write-Host "Reusing" $filepath
        return $filepath
    }

    # Download and retry up to 3 times in case of network transient errors.
    Write-Host "Downloading" $filename "from" $url
    $retry_attempts = 2
    for($i=0; $i -lt $retry_attempts; $i++){
        try {
            $webclient.DownloadFile($url, $filepath)
            break
        }
        Catch [Exception]{
            Start-Sleep 1
        }
   }
   if (Test-Path $filepath) {
       Write-Host "File saved at" $filepath
   } else {
       # Retry once to get the error message if any at the last try
       $webclient.DownloadFile($url, $filepath)
   }
   return $filepath
}


function InstallMiniconda ($python_version, $architecture, $python_home) {
    Write-Host "Installing Python" $python_version "for" $architecture "bit architecture to" $python_home
    if (Test-Path $python_home) {
        Write-Host $python_home "already exists, skipping."
        return $false
    }
    if ($architecture -eq "32") {
        $platform_suffix = "x86"
    } else {
        $platform_suffix = "x86_64"
    }
    $filepath = DownloadMiniconda $python_version $platform_suffix
    Write-Host "Installing" $filepath "to" $python_home
    $install_log = $python_home + ".log"
    $args = "/S /D=$python_home"
    Write-Host $filepath $args
    Start-Process -FilePath $filepath -ArgumentList $args -Wait -Passthru
    if (Test-Path $python_home) {
        Write-Host "Python $python_version ($architecture) installation complete"
    } else {
        Write-Host "Failed to install Python in $python_home"
        Get-Content -Path $install_log
        Exit 1
    }
}


function InstallMinicondaPip ($python_home) {
    $pip_path = $python_home + "\Scripts\pip.exe"
    $conda_path = $python_home + "\Scripts\conda.exe"
    if (-not(Test-Path $pip_path)) {
        Write-Host "Installing pip..."
        $args = "install --yes pip"
        Write-Host $conda_path $args
        Start-Process -FilePath "$conda_path" -ArgumentList $args -Wait -Passthru
    } else {
        Write-Host "pip already installed."
    }
}

function main () {
    InstallPython $env:PYTHON_VERSION $env:PYTHON_ARCH $env:PYTHON
    InstallPip $env:PYTHON
}

main
{'fraction_non_alphanumeric': 0.12270260808681953, 'fraction_numerical': 0.006301417819009277, 'mean_word_length': 2.7825223435948363, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 4, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 26, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1315217', 'n_tokens_mistral': 3997, 'n_tokens_neox': 3832, 'n_words': 990}