<commit_before>#!/usr/bin/env python
import sys
from boto import s3 as s3

conn = s3.connect_to_region("us-east-1")

def list_buckets():
	buckets = conn.get_all_buckets()
	for b in buckets:
		try:
			name=b.name
		except AttributeError:
			name="NoName"

		print ('Bucket Name: '+ name)

def list_files():
	bucketname=raw_input("Which bucket's files you want? ")
	if (conn.lookup(bucketname)):
		files=conn.get_bucket(bucketname).get_all_keys()
		print "Files: "
		for k in files:
			print k.name.encode('utf-8')
	else:
		print "No such bucket found."
		return

def list_policy():
	bucketname= raw_input("Which bucket's policy you want? ")
	try:
		policy=conn.get_bucket(bucketname).get_policy()
		print ("Policy for Bucket "+bucketname+": ")
		print policy
	except S3ResponseError:
		print ("Policy or Bucket not found.")
	
def bucket_delete():
	print ('Which bucket do you want to delete?')
	print ('* for all, bucket id or q to quit: ')
	bucket_to_delete= raw_input()
	if bucket_to_delete == "*":
		areyousure = raw_input("Are you sure (y/n)? ")
		if areyousure=="n":
			print('No buckets deleted.')
			return
		for i in conn.get_all_buckets():
			if (i.state=="running"):
				i.delete()
				print 'Bucket deleted successfully.'
	elif bucket_to_delete=="q":
		quit()
	else:
		conn.delete_buckets(bucket_to_delete)	
		print ('Terminated '+bucket_to_delete+'  successfully')

if ((len(sys.argv) > 1) and(sys.argv[1] == "term")) :
	bucket_delete()
elif ((len(sys.argv) > 1) and(sys.argv[1] == "policy")) :
	list_policy()
elif ((len(sys.argv) > 1) and(sys.argv[1] == "files")) :
	list_files()
else:<commit_msg>Added policy and list file functions.<commit_after>#!/usr/bin/env python
import sys
from boto import s3 as s3

conn = s3.connect_to_region("us-east-1")

def list_buckets():
	buckets = conn.get_all_buckets()
	for b in buckets:
		try:
			name=b.name
		except AttributeError:
			name="NoName"

		print ('Bucket Name: '+ name)

def list_files():
	bucketname=raw_input("Which bucket's files you want? ")
	count=0
	if (conn.lookup(bucketname)):
		files=conn.get_bucket(bucketname).get_all_keys()
		print "Files: "
		for k in files:
			count+=1
			print k.name.encode('utf-8')
		print ("\nTotal number of files: "+str(count))
		choice=raw_input("Would you like to download these files? ")
		if (choice=="n"): return
		else:
			print ("Downloading files...")
	else:
		print "No such bucket found."
		return

def list_policy():
	bucketname= raw_input("Which bucket's policy you want? ")
	try:
		policy=conn.get_bucket(bucketname).get_policy()
		print ("Policy for Bucket "+bucketname+": ")
		print policy
	except:
		print ("Policy or Bucket not found.")
	
def bucket_delete():
	print ('Which bucket do you want to delete?')
	print ('* for all, bucket id or q to quit: ')
	bucket_to_delete= raw_input()
	if bucket_to_delete == "*":
		areyousure = raw_input("Are you sure (y/n)? ")
		if areyousure=="n":
			print('No buckets deleted.')
			return
		for i in conn.get_all_buckets():
			if (i.state=="running"):
				i.delete()
				print 'Bucket deleted successfully.'
	elif bucket_to_delete=="q":
		quit()
	else:
		conn.delete_buckets(bucket_to_delete)	
		print ('Terminated '+bucket_to_delete+'  successfully')

if ((len(sys.argv) > 1) and(sys.argv[1] == "-p")) :
	list_policy()
elif ((len(sys.argv) > 1) and(sys.argv[1] == "-lf")) :
	list_files()
elif ((len(sys.argv) > 1) and(sys.argv[1] == "-gf")) :
	list_files()
else:
{'fraction_non_alphanumeric': 0.15652428320655354, 'fraction_numerical': 0.007314218841427736, 'mean_word_length': 4.36734693877551, 'pattern_counts': {'":': 8, '<': 3, '<?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': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1012451', 'n_tokens_mistral': 1346, 'n_tokens_neox': 1234, 'n_words': 329}