<commit_before>import os
from gtm import GTM

#Get the call in table file
if 'gtm_access_ci' not in os.environ:
	print "Please set environment variable gtm_access_ci to the location of gtm_access.ci"
	exit(0)
if not os.path.exists(os.environ['gtm_access_ci']):
	print "Error: {0} does not exist".format(os.environ['gtm_access_ci'])
	exit(0)
os.environ['GTMCI'] = os.environ['gtm_access_ci']

#Change working folder to database location
if 'gtm_data_dir' not in os.environ:
	print "Please set environment variable gtm_data_dir to the data folder"
if not os.path.exists(os.environ['gtm_data_dir']):
	print "Error: {0} does not exist".format(os.environ['gtm_data_dir'])
	exit(0)

originalDir = os.getcwd()
os.chdir(os.environ['gtm_data_dir'])
db = GTM()
os.chdir(originalDir)

def check_login(username, password):
	global db
	os.chdir(os.environ['gtm_data_dir'])
	
	db.execute('d loginLowLevel^user("{0}","{1}")'.format(username, password))
	result = int(db.get('%sess("authenticated")')), int(db.get('%sess("uid")'))

	os.chdir(originalDir)
	return result

<commit_msg>Fix character encoding<commit_after>import os
from gtm import GTM

#Get the call in table file
if 'gtm_access_ci' not in os.environ:
	print "Please set environment variable gtm_access_ci to the location of gtm_access.ci"
	exit(0)
if not os.path.exists(os.environ['gtm_access_ci']):
	print "Error: {0} does not exist".format(os.environ['gtm_access_ci'])
	exit(0)
os.environ['GTMCI'] = os.environ['gtm_access_ci']

#Change working folder to database location
if 'gtm_data_dir' not in os.environ:
	print "Please set environment variable gtm_data_dir to the data folder"
if not os.path.exists(os.environ['gtm_data_dir']):
	print "Error: {0} does not exist".format(os.environ['gtm_data_dir'])
	exit(0)

originalDir = os.getcwd()
os.chdir(os.environ['gtm_data_dir'])
db = GTM()
os.chdir(originalDir)

def check_login(username, password):
	global db
	os.chdir(os.environ['gtm_data_dir'])
	
	db.execute(b'd loginLowLevel^user("{0}","{1}")'.format(username.encode('ascii', 'xmlcharrefreplace'), password.encode('ascii', '<PASSWORD>')))
	result = int(db.get('%sess("authenticated")')), int(db.get('%sess("uid")'))

	os.chdir(originalDir)
	return result


{'fraction_non_alphanumeric': 0.15377657168701944, 'fraction_numerical': 0.006331976481230212, 'mean_word_length': 6.498305084745763, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 4, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 1}, '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': '624612', 'n_tokens_mistral': 824, 'n_tokens_neox': 833, 'n_words': 190}