<commit_before>#!/usr/bin/env bash

set -eu

if [[ $# -lt "2" || $# -gt "6" ]]; then
	echo "Usage: $(basename $0) DEST_BUCKET DEST_PREFIX [DEST_REGION [SOURCE_BUCKET SOURCE_PREFIX [SOURCE_REGION]]]" >&2
	echo "  DEST_BUCKET:   destination S3 bucket name." >&2
	echo "  DEST_REGION:   destination bucket region, e.g. us-west-1; default: 's3'." >&2
	echo "  DEST_PREFIX:   destination prefix, e.g. '' or 'dist-stable/'." >&2
	echo "  SOURCE_BUCKET: source S3 bucket name; default: '\$S3_BUCKET'." >&2
	echo "  SOURCE_REGION: source bucket region; default: '\$S3_REGION' or 's3'." >&2
	echo "  SOURCE_PREFIX: source prefix; default: '\${S3_PREFIX}'." >&2
	exit 2
fi

dst_bucket=$1; shift
dst_prefix=$1; shift
if [[ $# -gt 2 ]]; then
	# region name given
	dst_region=$1; shift
else
	dst_region="s3"
fi
src_bucket=${1:-$S3_BUCKET}; shift
src_prefix=${1:-$S3_PREFIX}; shift
if [[ $# == "1" ]]; then
	# region name given
	src_region=$1; shift
else
	src_region=${S3_REGION:-"s3"}
fi

src_tmp=$(mktemp -d -t "src-repo.XXXXX")<commit_msg>fix sync.sh exiting 1 with two arguments<commit_after>#!/usr/bin/env bash

set -eu

if [[ $# -lt "2" || $# -gt "6" ]]; then
	echo "Usage: $(basename $0) DEST_BUCKET DEST_PREFIX [DEST_REGION [SOURCE_BUCKET SOURCE_PREFIX [SOURCE_REGION]]]" >&2
	echo "  DEST_BUCKET:   destination S3 bucket name." >&2
	echo "  DEST_REGION:   destination bucket region, e.g. us-west-1; default: 's3'." >&2
	echo "  DEST_PREFIX:   destination prefix, e.g. '' or 'dist-stable/'." >&2
	echo "  SOURCE_BUCKET: source S3 bucket name; default: '\$S3_BUCKET'." >&2
	echo "  SOURCE_REGION: source bucket region; default: '\$S3_REGION' or 's3'." >&2
	echo "  SOURCE_PREFIX: source prefix; default: '\${S3_PREFIX}'." >&2
	exit 2
fi

dst_bucket=$1; shift
dst_prefix=$1; shift
if [[ $# -gt 2 ]]; then
	# region name given
	dst_region=$1; shift
else
	dst_region="s3"
fi
echo "$@"
src_bucket=${1:-$S3_BUCKET}; shift || true
src_prefix=${1:-$S3_PREFIX}; shift || true
if [[ $# == "1" ]]; then
	# region name given
	src_region=$1; shift
else
	src_region=${S3_REGION:-"s3"}
fi

src_tmp=$(mktemp -d -t "src-repo.XXXXX")
{'fraction_non_alphanumeric': 0.1816026552868658, 'fraction_numerical': 0.030820293978188716, 'mean_word_length': 4.328282828282828, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 17, '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': '1525375', 'n_tokens_mistral': 868, 'n_tokens_neox': 864, 'n_words': 228}