<commit_before>import csv
import inspect
import os

from pymongo import MongoClient


class EdX(object):

    def __init__(self, args):
        self.url = args.url
        client = MongoClient(self.url)
        self.db = client[args.db_name]
        self._collections = None
        self.output_directory = args.output_directory
        self.row_limit = args.row_limit
        self.csv_data = None
        self.list_of_headers = None
        
    def generate_csv(self, csv_data, list_of_headers, output_file):
    	"""
    	Genersate csv report from generated data and given list of headers
    	"""
    	self.csv_data = csv_data
    	self.list_of_headers = list_of_headers
    	number_of_rows = len(csv_data) + 1
        if number_of_rows <= self.row_limit:
	        self._write_to_csv(output_file)
        else:
	        if number_of_rows % self.row_limit:
		        number_of_splits = number_of_rows // self.row_limit + 1
	        else:
		        number_of_splits = number_of_rows // self.row_limit
	        for index in xrange(number_of_splits):
	            self._write_to_csv(output_file.split('.')[0] + '_' + str(index) + '.csv', index)<commit_msg>Fix mistakes in instance variables<commit_after>import csv
import inspect
import os

from pymongo import MongoClient


class EdX(object):

    def __init__(self, args):
        self.uri = args.uri
        client = MongoClient(self.uri)
        self.db = client[args.db_name]
        self._collections = None
        self.output_directory = args.output_directory
        self.row_limit = args.row_limit
        self.csv_data = None
        self.list_of_headers = None
        
    def generate_csv(self, csv_data, list_of_headers, output_file):
    	"""
    	Genersate csv report from generated data and given list of headers
    	"""
    	self.csv_data = csv_data
    	self.list_of_headers = list_of_headers
    	number_of_rows = len(csv_data) + 1
        if number_of_rows <= self.row_limit:
	        self._write_to_csv(output_file)
        else:
	        if number_of_rows % self.row_limit:
		        number_of_splits = number_of_rows // self.row_limit + 1
	        else:
		        number_of_splits = number_of_rows // self.row_limit
	        for index in xrange(number_of_splits):
	            self._write_to_csv(output_file.split('.')[0] + '_' + str(index) + '.csv', index)
{'fraction_non_alphanumeric': 0.08572653236176597, 'fraction_numerical': 0.002571795970852979, 'mean_word_length': 2.520361990950226, 'pattern_counts': {'":': 0, '<': 5, '<?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': '4972444', 'n_tokens_mistral': 779, 'n_tokens_neox': 739, 'n_words': 159}