<commit_before>#!/usr/bin/env bash
# Author: <NAME>
# Date: 25 03 2014
# The aim of this script is to download a version of the Android platform for a
# given version from the Google website. This can be used in case eclipse does
# not allow you to do it, say if the folder where the Android sdk is installed
# does not allow us to write.

if [[ $# -ne 1 ]]; then
    echo "Usage: $0 <api-level>"
    echo "Where the api-level is between 1 and 19."
    exit 1
fi

VERSION=$1

ROOTURL=http://dl-ssl.google.com/android/repository
REPXML=repository-8.xml

case $1 in
    2) VERSION=-1.1
        ;;
    3) VERSION=-1.5
        ;;
    4) VERSION=-1.6
        ;;
    5) VERSION=-2.0
        ;;
    6) VERSION=-2.0.1
        ;;
    7) VERSION=-2.1
        ;;
    8) VERSION=-2.2
        ;;
    9) VERSION=-2.3.1
        ;;
    10) VERSION=-2.3.3
        ;;
    11) VERSION=-3.0
        ;;
    12) VERSION=-3.1
        ;;
    13) VERSION=-3.2
        ;;
esac

if [[ ! -f $REPXML ]]; then
    wget $ROOTURL/$REPXML
fi

if [[ $1 -le 6 ]]; then
    FILE=`grep 'sdk:url>android' $REPXML | sed -e 's/\(.*\)\(and\)/\2/' -e\
        's/<.*//' | grep -e $VERSION | grep linux`
    SHA=`grep -B 1 -e android$VERSION $REPXML | grep -B 1 linux | grep sha1 | sed -e 's/.*sha1">//' -e 's/<.*//'`
    echo "$SHA  $FILE"
else
    FILE=`grep 'sdk:url>android' $REPXML | sed -e 's/\(.*\)\(and\)/\2/' -e\
        's/<.*//' | grep -e $VERSION`
    SHA=`grep -B 1 -e android$VERSION $REPXML | grep sha1 | sed -e 's/.*sha1">//' -e 's/<.*//'`
    echo "$SHA  $FILE"
fi

if [[ ! -f $FILE ]]; then
    wget $ROOTURL/$FILE
    echo "$SHA  $FILE" | sha1sum -c > /dev/null 2>&1
    if [[ $? -ne 0 ]]; then
        echo "Checksum failed! Aborting..."
        exit 1
    fi
fi


FOLDER=${FILE%.zip}

if [[ ! -d $FOLDER ]]; then
    unzip -q $FILE
fi

if [[ ! -h android-$1 ]]; then
    ln -s $FOLDER android-$1
fi<commit_msg>Now adding the repository parameter as part of the to get plaform<commit_after>#!/usr/bin/env bash
# Author: <NAME>
# Date: 25 03 2014
# The aim of this script is to download a version of the Android platform for a
# given version from the Google website. This can be used in case eclipse does
# not allow you to do it, say if the folder where the Android sdk is installed
# does not allow us to write.

usage() {
    echo "Usage: $0 <api-level> <dest-folder>"
    echo "Where the api-level is between 1 and 19."
}

if [[ $# -ne 2 ]]; then
    usage
    exit 1
fi

if [[ $1 -gt 19 || $1 -lt 1 ]]; then
    usage
    exit 1
fi

VERSION=$1
DEST_FOLDER=$2

ROOTURL=http://dl-ssl.google.com/android/repository
REPXML=repository-8.xml

case $1 in
    2) VERSION=-1.1
        ;;
    3) VERSION=-1.5
        ;;
    4) VERSION=-1.6
        ;;
    5) VERSION=-2.0
        ;;
    6) VERSION=-2.0.1
        ;;
    7) VERSION=-2.1
        ;;
    8) VERSION=-2.2
        ;;
    9) VERSION=-2.3.1
        ;;
    10) VERSION=-2.3.3
        ;;
    11) VERSION=-3.0
        ;;
    12) VERSION=-3.1
        ;;
    13) VERSION=-3.2
        ;;
    *) VERSION=-$VERSION
esac

if [[ ! -f $ROOTURL/$REPXML ]]; then
    wget $ROOTURL/$REPXML -P $DEST_FOLDER
fi

if [[ $1 -le 6 ]]; then
    FILE=`grep 'sdk:url>android' "$DEST_FOLDER/$REPXML" | sed -e 's/\(.*\)\(and\)/\2/' -e\
        's/<.*//' | grep -e $VERSION | grep linux`
    SHA=`grep -B 1 -e android$VERSION "$DEST_FOLDER/$REPXML" | grep -B 1 linux | grep sha1 | sed -e 's/.*sha1">//' -e 's/<.*//'`
else
    FILE=`grep 'sdk:url>android' "$DEST_FOLDER/$REPXML" | sed -e 's/\(.*\)\(and\)/\2/' -e\
        's/<.*//' | grep -e $VERSION`
    SHA=`grep -B 1 -e android$VERSION "$DEST_FOLDER/$REPXML" | grep sha1 | sed -e 's/.*sha1">//' -e 's/<.*//'`
fi

if [[ ! -f $FILE ]]; then
    wget $ROOTURL/$FILE -P "$DEST_FOLDER"
    echo "$SHA  $DEST_FOLDER/$FILE" | sha1sum -c > /dev/null 2>&1
    if [[ $? -ne 0 ]]; then
        echo "Checksum failed! Aborting..."
        exit 1
    fi
fi

FOLDER=${FILE%.zip}

if [[ ! -d $DEST_FOLDER/$FOLDER ]]; then
    unzip -q $DEST_FOLDER/$FILE -d $DEST_FOLDER
fi

if [[ ! -h $DEST_FOLDER/android-$1 ]]; then
    ln -s $DEST_FOLDER/$FOLDER $DEST_FOLDER/android-$1
fi
{'fraction_non_alphanumeric': 0.18727228564488704, 'fraction_numerical': 0.0395919358756376, 'mean_word_length': 2.010233918128655, 'pattern_counts': {'":': 0, '<': 16, '<?xml version=': 0, '>': 20, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2703755', 'n_tokens_mistral': 1771, 'n_tokens_neox': 1677, 'n_words': 483}