<commit_before>import re
import time
import json
import datetime

from django import template
register = template.Library()

from django.contrib.auth.models import User
from userprofile.models import Profile

import pymongo
from pymongo import MongoClient
from pymongo import ASCENDING, DESCENDING
client = MongoClient('localhost', 27017)

mongo = client.cloudly

def _seconds_since_epoch(d):

	date_time = d.isoformat().split('.')[0].replace('T',' ')
	pattern = '%Y-%m-%d %H:%M:%S'
	seconds_since_epoch = int(time.mktime(time.strptime(date_time, pattern)))

	return seconds_since_epoch


@register.filter(name='dict_get')
def dict_get(h, key):

	try: return h[key]
	except: pass
		
	return None


@register.filter(name="count_list")
def count_list(x):
	return len(x)	

@register.filter(name="times_hundred")
def times_hundred(x):
	try:
		return float(x)*100
	except:
		return "error"

@register.filter(name="times_hundred_rounded")
def times_hundred_rounded(x):
	return int(float(x)*100)


@register.filter(name='clear_filename')
def clear_filename(f):
	try:
		return str(f)[20:]
	except:
		return f


@register.filter(name='shorten_key')
def shorten_key(key):
	return key[:11]+'..'

@register.filter(name='shorten_string')
def shorten_string(x,shorten):
	return x[:shorten]
	
@register.filter(name='get_file_extension')
def get_file_extension(f):
	return str(f).split('.')[-1:][0]


@register.filter(name='replace_dots')
def replace_dots(text):<commit_msg>added on another exception on the template tags<commit_after>import re
import time
import json
import datetime

from django import template
register = template.Library()

from django.contrib.auth.models import User
from userprofile.models import Profile

import pymongo
from pymongo import MongoClient
from pymongo import ASCENDING, DESCENDING
client = MongoClient('localhost', 27017)

mongo = client.cloudly

def _seconds_since_epoch(d):

	date_time = d.isoformat().split('.')[0].replace('T',' ')
	pattern = '%Y-%m-%d %H:%M:%S'
	seconds_since_epoch = int(time.mktime(time.strptime(date_time, pattern)))

	return seconds_since_epoch


@register.filter(name='dict_get')
def dict_get(h, key):

	try: return h[key]
	except: pass
		
	return None


@register.filter(name="count_list")
def count_list(x):
	return len(x)	

@register.filter(name="times_hundred")
def times_hundred(x):
	try:
		return float(x)*100
	except:
		return "error"

@register.filter(name="times_hundred_rounded")
def times_hundred_rounded(x):
	try:
		return int(float(x)*100)
	except:
		return "error"

@register.filter(name='clear_filename')
def clear_filename(f):
	try:
		return str(f)[20:]
	except:
		return f


@register.filter(name='shorten_key')
def shorten_key(key):
	return key[:11]+'..'

@register.filter(name='shorten_string')
def shorten_string(x,shorten):
	return x[:shorten]
	
@register.filter(name='get_file_extension')
def get_file_extension(f):
	return str(f).split('.')[-1:][0]


@register.filter(name='replace_dots')
def replace_dots(text):
{'fraction_non_alphanumeric': 0.14084507042253522, 'fraction_numerical': 0.012072434607645875, 'mean_word_length': 6.4575, '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': '7540400', 'n_tokens_mistral': 1107, 'n_tokens_neox': 1039, 'n_words': 224}