<commit_before>#!/usr/bin/python3
import cgi
import ccookie
from string import Template
import sys
import configparser
import os

import cgitb
cgitb.enable()

class index:

	def __init__(self):
		self.__cfg = configparser.ConfigParser()
		self.__cookieExist()
		self.__pfx = None
		self.__useCookie = 0

	def loadConfig(self):
		self.__loadConfigFile()
		self.__loadDefaultConf('DEFAULT')
		self.__loadIndexConf()

	def __cookieExist(self):
		if 'HTPP_COOKIE' in os.environ:
			self.__cookieExist = 1
		else:
			self.__cookieExist = 0

	def useCookie(self):
		if self.__useCookie:
			pass

	def __loadConfigFile(self):
		self.__cfg.read('conf.ini')

	def __loadDefaultConf(self, section):
		for key in self.__cfg[section]:
			if key == 'pfx':
				self.__pfx = self.__getConfItem(section, key)
			elif key == 'trp':
				self.__trp = self.__getConfItem(section, key)
			elif key == 'cookie':
				self.__useCookie = int(self.__getConfItem(section, key))
			elif key == 'mysql':
				self.__mysql = int(self.__getConfItem(section, key))

	def __getConfItem(self, section, key):
		return self.__cfg[section][key]

	def __loadIndexConf(self):
		section = 'INDEX'
		for key in self.__cfg[section]:
			if key == 'title':
				self.__title = self.__getConfItem(section, key)

	def loadElements(self):
		pass

	def render(self):
		pass

	def printPage(self):
		print(self.__page)

	def connectData(self):
		pass

	def getPage(self):
		return self.__page

	def loadTemplates(self):
		self.__page = open('template/head.html').read()
<commit_msg>Bug fix at readTemplate function!<commit_after>#!/usr/bin/python3
import cgi
import ccookie
from string import Template
import sys
import configparser
import os

import cgitb
cgitb.enable()

class index:

	def __init__(self):
		self.__cfg = configparser.ConfigParser()
		self.__cookieExist()
		self.__pfx = None
		self.__useCookie = 0

	def loadConfig(self):
		self.__loadConfigFile()
		self.__loadDefaultConf('DEFAULT')
		self.__loadIndexConf()

	def __cookieExist(self):
		if 'HTPP_COOKIE' in os.environ:
			self.__cookieExist = 1
		else:
			self.__cookieExist = 0

	def useCookie(self):
		if self.__useCookie:
			pass

	def __loadConfigFile(self):
		self.__cfg.read('conf.ini')

	def __loadDefaultConf(self, section):
		for key in self.__cfg[section]:
			if key == 'pfx':
				self.__pfx = self.__getConfItem(section, key)
			elif key == 'trp':
				self.__trp = self.__getConfItem(section, key)
			elif key == 'cookie':
				self.__useCookie = int(self.__getConfItem(section, key))
			elif key == 'mysql':
				self.__mysql = int(self.__getConfItem(section, key))

	def __getConfItem(self, section, key):
		return self.__cfg[section][key]

	def __loadIndexConf(self):
		section = 'INDEX'
		for key in self.__cfg[section]:
			if key == 'title':
				self.__title = self.__getConfItem(section, key)

	def loadElements(self):
		pass

	def render(self):
		pass

	def printPage(self):
		print(self.__page)

	def connectData(self):
		pass

	def getPage(self):
		return self.__page

	def loadTemplates(self):
		self.__page = ' '
		f = open('template/head.html')
		for line in f:
			self.__page += line

{'fraction_non_alphanumeric': 0.12192, 'fraction_numerical': 0.00256, 'mean_word_length': 4.099510603588907, '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': '2809502', 'n_tokens_mistral': 1204, 'n_tokens_neox': 1060, 'n_words': 259}