import random, string, os

base_dir = os.path.dirname(__file__)

DATA_BLANK = "{{ \"{dataTitle}\": [{dataContent}] }}"
ITEM_BLANK = "{{ \"{itemName}\": {{ {itemContent} }} }}"
ITEM_CONTENT = "\"{contentName}\": {data}"

class DataCreator:

	DATA = ""

	def __init__(self, dataTitle="data", numItemsToGenerate=10, dataTypeArr=[["integer", "IntDataTitle", [0, 100]], ["string", "StringDataTitle", [10, 15]], ["boolean", "BoolDataTitle"]]):
		print "Generating Data..."

		items = ""
		for x in range(numItemsToGenerate):
			itemContent = ""
			for index, i in enumerate(dataTypeArr):
				if (i[0] == "integer" or i[0] == "int" or i[0] == "Int" or i[0] == "Integer"):
					data = random.randint(i[2][0], i[2][1])

				elif (i[0] == "string" or i[0] == "str" or i[0] == "String" or i[0] == "Str"):
					data = '"' + ''.join(random.choice(string.lowercase) for a in range(random.choice([i[2][0], i[2][1]]))) + '"'

				elif (i[0] == "boolean" or i[0] == "bool" or i[0] == "Boolean" or i[0] == "Bool"):
					data = random.choice(["true", "false"])

				elif (i[0] == "float" or i[0] == "Float"):
					data = random.uniform(i[2][0], i[2][1])

				else:
					raise ValueError('Invalid Type: ' + '"' + i[0] + '"')

				itemContent += ITEM_CONTENT.format(contentName=i[1], data=str(data))
				if index < len(dataTypeArr) - 1:
					itemContent += ", "
			items += ITEM_BLANK.format(itemName="Item" + str(x), itemContent=itemContent)
			if x < numItemsToGenerate - 1:
				items += ", "

		self.DATA = DATA_BLANK.format(dataTitle=dataTitle, dataContent=items)
		print "Data Creation Complete..."


	def export(self, filename):
		print "Exporting " + filename + ".json"
		with open(filename + ".json", "w") as f:
			f.write(self.DATA)
		print "File Saved At: " + base_dir + "\\" + filename + ".json"
		

@@ -1,8 +1,1133 @@
+# MIT License%0A#%0A# Copyright (c) 2017 Jacob A. Gornall%0A#%0A# Permission is hereby granted, free of charge, to any person obtaining a copy %0A# of this software and associated documentation files (the %22Software%22), to deal %0A# in the Software without restriction, including without limitation the rights %0A# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell %0A# copies of the Software, and to permit persons to whom the Software is %0A# furnished to do so, subject to the following conditions:%0A#%0A# The above copyright notice and this permission notice shall be included in all %0A# copies or substantial portions of the Software.%0A#%0A# THE SOFTWARE IS PROVIDED %22AS IS%22, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR %0A# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, %0A# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE %0A# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER %0A# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, %0A# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE %0A# SOFTWARE.%0A%0A%0A
 import r

Add license to code