<commit_before>#!/usr/bin/env python

import os, subprocess, sys, time, os, platform, json

arch = platform.machine()
debug = open("debug.log", "w")
ESC = chr(27)
config = json.load(open("flashconfig"))

print "getting sudo password"
sudo_cmd = "sudo echo".split()
if subprocess.call(sudo_cmd):
	raw_input("error: wrong password")
	exit(1)<commit_msg>flash.py: check for valid flashconfig<commit_after>#!/usr/bin/env python

import os, subprocess, sys, time, os, platform, json

arch = platform.machine()
debug = open("debug.log", "w")
ESC = chr(27)

try:
	config_file = open("flashconfig")
except:
	exit("\n"
	"ERROR: flashconfig not found. try:\n"
	"  $ cp flashconfig.sample flashconfig\n"
	"  set OPENOCD_PATH and GDB_PATH in flashconfig and retry.\n")

try:
	config = json.load(config_file)
except:
	exit("\n"
	"ERROR: invalid flashconfig")


print "getting sudo password"
sudo_cmd = "sudo echo".split()
if subprocess.call(sudo_cmd):
	raw_input("error: wrong password")
	exit(1)
{'fraction_non_alphanumeric': 0.1515768056968464, 'fraction_numerical': 0.006103763987792472, 'mean_word_length': 5.3076923076923075, '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': '2152747', 'n_tokens_mistral': 362, 'n_tokens_neox': 345, 'n_words': 94}