Example #1
0
def json_init(path):
	data = jsonconf.read_json(path)
	#TODO:rewrite data
	for ftype in labels:
		data['code'][0][ftype][0]['lines'] = code_rewrite(0,0)

		data['code'][0][ftype][0]['note'] = code_rewrite(0,0)

		data['code'][0][ftype][0]['null'] = code_rewrite(0,0)

		data['code'][0][ftype][0]['file'] = code_rewrite(0,0)

	for index in range(0,len(labels)):
		data['date'][0]['date-y'][index]['file'] = 0
		data['date'][0]['date-y'][index]['lines'] = 0

		data['date'][0]['date-m'][index]['file'] = 0
		data['date'][0]['date-m'][index]['lines'] = 0

		data['date'][0]['date-w'][index]['file'] = 0
		data['date'][0]['date-w'][index]['lines'] = 0

		data['date'][0]['date-d'][index]['file'] = 0
		data['date'][0]['date-d'][index]['lines'] = 0

		data['date'][0]['date-h'][index]['file'] = 0
		data['date'][0]['date-h'][index]['lines'] = 0

	jsonconf.write_json(path, data)
Example #2
0
def json_rewrite(path, ftype, lines, note, null, date):
	data = jsonconf.read_json(path)
	#TODO:rewrite data
	index = ftype_mapindex(ftype)

	data['code'][0][ftype_maptype(ftype)][0]['lines'] = code_rewrite(data['code'][0][ftype_maptype(ftype)][0]['lines'], lines)

	data['code'][0][ftype_maptype(ftype)][0]['note'] = code_rewrite(data['code'][0][ftype_maptype(ftype)][0]['note'], note)

	data['code'][0][ftype_maptype(ftype)][0]['null'] = code_rewrite(data['code'][0][ftype_maptype(ftype)][0]['null'], null)

	data['code'][0][ftype_maptype(ftype)][0]['file'] = code_rewrite(data['code'][0][ftype_maptype(ftype)][0]['file'], FILENUM)


	data['date'][0]['date-y'][index]['file'] = date_rewrite(data['date'][0]['date-y'][index]['file'], 'date-y', date, FILENUM)
	data['date'][0]['date-y'][index]['lines'] = date_rewrite(data['date'][0]['date-y'][index]['lines'], 'date-y', date, lines)

	data['date'][0]['date-m'][index]['file'] = date_rewrite(data['date'][0]['date-m'][index]['file'], 'date-m', date, FILENUM)
	data['date'][0]['date-m'][index]['lines'] = date_rewrite(data['date'][0]['date-m'][index]['lines'], 'date-m', date, lines)

	data['date'][0]['date-w'][index]['file'] = date_rewrite(data['date'][0]['date-w'][index]['file'], 'date-w', date, FILENUM)
	data['date'][0]['date-w'][index]['lines'] = date_rewrite(data['date'][0]['date-w'][index]['lines'], 'date-w', date, lines)

	data['date'][0]['date-d'][index]['file'] = date_rewrite(data['date'][0]['date-d'][index]['file'], 'date-d', date, FILENUM)
	data['date'][0]['date-d'][index]['lines'] = date_rewrite(data['date'][0]['date-d'][index]['lines'], 'date-d', date, lines)

	data['date'][0]['date-h'][index]['file'] = date_rewrite(data['date'][0]['date-h'][index]['file'], 'date-h', date, FILENUM)
	data['date'][0]['date-h'][index]['lines'] = date_rewrite(data['date'][0]['date-h'][index]['lines'], 'date-h', date, lines)

	jsonconf.write_json(path, data)
Example #3
0
def build_data_model_lines(path):
	temp  = jsonconf.read_json(path+'/conf/codeeye.json')
	data = []
	for ftype in labels:
		data.append(temp['code'][0][ftype][0]['lines'])

	ltype = [index for index in range(0,9)]

	data = data[:-1]
	templates.bar(ltype, data, 'bar-lines')
	templates.sector(data,'sector-lines')