<commit_before>import pymongo
import collections
import sys

connection_url = sys.argv[2]
client = pymongo.MongoClient(connection_url)
database = client[sys.argv[3]]
collection = database['whiteboards']

def action_push(bid, action, time):
    collection.update({'_id': bid}, {'$push': {'layers': action}, '$set': {'timestamp': time}}, upsert = True)

def action_remove(bid, action_id, time):
    collection.update({'_id': bid}, {'$pull': {'layers': {'action_id': action_id}}, '$set': {'timestamp': time}}, upsert = True)

def rewrite(bid, data):
    collection.update({'_id': bid}, data, upsert = True)
    
def load(bid):
    return collection.find_one({'_id': bid})

def load_meta():
    results = []
    for i in collection.find({}, {'_id': True, 'timestamp': True}):
        results.append({
            'name': i['_id'],
            'timestamp': i.get('timestamp', 0)
        })
    return results<commit_msg>Indent with tabs<commit_after>import pymongo
import collections
import sys

connection_url = sys.argv[2]
client = pymongo.MongoClient(connection_url)
database = client[sys.argv[3]]
collection = database['whiteboards']

def action_push(bid, action, time):
	collection.update({'_id': bid}, {'$push': {'layers': action}, '$set': {'timestamp': time}}, upsert = True)

def action_remove(bid, action_id, time):
	collection.update({'_id': bid}, {'$pull': {'layers': {'action_id': action_id}}, '$set': {'timestamp': time}}, upsert = True)

def rewrite(bid, data):
	collection.update({'_id': bid}, data, upsert = True)

def load(bid):
	return collection.find_one({'_id': bid})

def load_meta():
	results = []
	for i in collection.find({}, {'_id': True, 'timestamp': True}):
		results.append({
			'name': i['_id'],
			'timestamp': i.get('timestamp', 0)
		})
	return results
{'fraction_non_alphanumeric': 0.1923509561304837, 'fraction_numerical': 0.003374578177727784, 'mean_word_length': 5.092465753424658, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '2163787', 'n_tokens_mistral': 582, 'n_tokens_neox': 572, 'n_words': 151}