<commit_before>#-------------------------------------------------------------------------------
# Name:        cs612-a1
# Description: Assignment 1 methods for loading data with Numpy
#
# Author:      kingrichard2005
#
# Created:     2015-02-20
# Copyright:   (c) kingrichard2005 2015
# Licence:     MIT
#-------------------------------------------------------------------------------
import numpy as np
import unittest
from tempfile import TemporaryFile

class TestHelper():
   # A test helper class
   def __init__(self, numberOfNumbers = 100, rangeOfEachNumber = 100 ):
      self.tempTestFile    = TemporaryFile();
      self.aBunchOfIntegers = np.random.randint(rangeOfEachNumber, size=numberOfNumbers);
      self.writeABunchOfNumbersToATempFile();

   def writeABunchOfNumbersToATempFile(self):
      try:
         # Writes a bunch of numbers to a temp test file
         np.save(self.tempTestFile, self.aBunchOfIntegers)
         self.tempTestFile.seek(0);
      except:
         print "error in writeABunchOfNumbersToAFile(...)"

class DataManager():
    # Assignment 1 class
    def __init__(self):
        self.OneD        = [];
        self.TwoD        = [[]];
        self.array1      = [[]];
        self.array2      = [[]];
        self.array3      = [[]];
        self.File1Handle = TemporaryFile();
        self.File2Handle = TemporaryFile();
        self.File3Handle = TemporaryFile();

    def method1LoadAFileToOneD( self, aFileObj ):
        try:
            # Method 1
            self.OneD = np.load(aFileObj);
        except:
            print "error in method1LoadAFile(...)"

    def method2CreateTwoD( self, rangeOfRandInts = 100, square_dim = 5 ):<commit_msg>Update to class initializer<commit_after>#-------------------------------------------------------------------------------
# Name:        cs612-a1
# Description: Assignment 1 methods for loading data with Numpy
#
# Author:      kingrichard2005
#
# Created:     2015-02-20
# Copyright:   (c) kingrichard2005 2015
# Licence:     MIT
#-------------------------------------------------------------------------------
import numpy as np
import unittest
from tempfile import TemporaryFile

class TestHelper():
   # A test helper class
   def __init__(self, numberOfNumbers = 100, rangeOfEachNumber = 100 ):
      self.tempTestFile    = TemporaryFile();
      self.aBunchOfIntegers = np.random.randint(rangeOfEachNumber, size=numberOfNumbers);
      self.writeABunchOfNumbersToATempFile();

   def writeABunchOfNumbersToATempFile(self):
      try:
         # Writes a bunch of numbers to a temp test file
         np.save(self.tempTestFile, self.aBunchOfIntegers)
         self.tempTestFile.seek(0);
      except:
         print "error in writeABunchOfNumbersToAFile(...)"

class DataManager():
    # Assignment 1 class
    def __init__(self, rangeOfRandInts = 100, square_dim = 5 ):
        self.OneD        = [];
        self.TwoD        = np.random.random_integers(rangeOfRandInts, size=(square_dim,square_dim));
        self.array1      = [[]];
        self.array2      = [[]];
        self.array3      = [[]];
        self.File1Handle = TemporaryFile();
        self.File2Handle = TemporaryFile();
        self.File3Handle = TemporaryFile();

    def method1LoadAFileToOneD( self, aFileObj ):
        try:
            # Method 1
            self.OneD = np.load(aFileObj);
        except:
            print "error in method1LoadAFile(...)"

    def method2CreateNewTwoD( self, rangeOfRandInts = 100, square_dim = 5 ):
{'fraction_non_alphanumeric': 0.18376679051157474, 'fraction_numerical': 0.028008002286367534, 'mean_word_length': 1.8925619834710743, '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': '1471049', 'n_tokens_mistral': 1068, 'n_tokens_neox': 979, 'n_words': 229}