<commit_before># -*- coding: utf-8 -*-
from __future__ import unicode_literals

import os
import io

from nvd3.discreteBarChart import discreteBarChart
from nvd3.pieChart import pieChart

class DataRenderer(object):

	def render(self, configurators):
		for configurator in configurators:
			data_renderer = configurator.renderer		
			configurator.stats.chart = data_renderer.render(configurator.stats.data)
		return configurators

class ChartRenderer(object):
	
	def __init__(self):
		self.display_container=False
		self.height=400
		self.width=600
		
	def render(self, data):
		# sorting data by ascending
		xdata = sorted(data.keys())
		ydata = [] 
		extra_serie = {"tooltip": {"y_start": "", "y_end": " posts"}}
		# TODO(romainx): maybe there is a smarter way to do that ?
		for x in xdata:
			ydata.append(data.get(x))
		self.chart.add_serie(y=ydata, x=xdata, extra=extra_serie)
		self.build()
		return self.chart

	def build(self):
		# building chart + container
		self.chart.buildcontent()

class DiscreteBarChartRenderer(ChartRenderer):
	
	def __init__(self, name):
		super(DiscreteBarChartRenderer, self).__init__()
		self.chart = discreteBarChart(name=name, display_container=self.display_container, height=self.height, width=self.width)

class PieChartRenderer(ChartRenderer):
	
	def __init__(self, name):
		super(PieChartRenderer, self).__init__()
		self.chart = pieChart(name=name, display_container=self.display_container, height=self.height, width=self.width)<commit_msg>parameter change<commit_after># -*- coding: utf-8 -*-
from __future__ import unicode_literals

import os
import io

from nvd3.discreteBarChart import discreteBarChart
from nvd3.pieChart import pieChart

class DataRenderer(object):

	def render(self, configurators):
		for configurator in configurators:
			data_renderer = configurator.renderer		
			configurator.stats.chart = data_renderer.render(configurator.stats.data)
		return configurators

class ChartRenderer(object):
	
	def __init__(self):
		self.display_container=False
		self.height=300
		self.width=600
		
	def render(self, data):
		# sorting data by ascending
		xdata = sorted(data.keys())
		ydata = [] 
		extra_serie = {"tooltip": {"y_start": "", "y_end": " posts"}}
		# TODO(romainx): maybe there is a smarter way to do that ?
		for x in xdata:
			ydata.append(data.get(x))
		self.chart.add_serie(y=ydata, x=xdata, extra=extra_serie)
		self.build()
		return self.chart

	def build(self):
		# building chart + container
		self.chart.buildcontent()

class DiscreteBarChartRenderer(ChartRenderer):
	
	def __init__(self, name):
		super(DiscreteBarChartRenderer, self).__init__()
		self.chart = discreteBarChart(name=name, display_container=self.display_container, height=self.height, width=self.width)

class PieChartRenderer(ChartRenderer):
	
	def __init__(self, name):
		super(PieChartRenderer, self).__init__()
		self.chart = pieChart(name=name, display_container=self.display_container, height=self.height, width=self.width)
{'fraction_non_alphanumeric': 0.11099899091826437, 'fraction_numerical': 0.006054490413723511, 'mean_word_length': 5.354700854700854, 'pattern_counts': {'":': 6, '<': 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': '7119261', 'n_tokens_mistral': 1042, 'n_tokens_neox': 958, 'n_words': 214}