from utils import file_templates
from utils.validation import is_valid_gpu_mem


def main():
	gpu_mem = 0
	while gpu_mem == 0:
		user_input = raw_input("Enter GPU memory in MB (16/32/64/128/256): ")
		if is_valid_gpu_mem(user_input):
			gpu_mem = user_input
		else:
			print("Acceptable memory values are: 16/32/64/128/256")
	update_file('/boot/config.txt', gpu_mem)


def update_file(path, gpu_mem):
	data = {
		'gpu_mem': gpu_mem
	}
	template_name = path.split('/')[-1]
	new_file_data = file_templates.build(template_name, data)
	with open(path, 'w') as f:
		f.write(new_file_data)


if __name__ == '__main__':
	main()

from utils import file_templates
from utils.validation import is_valid_gpu_mem


def main():
	user_input = raw_input("Want to change the GPU memory split? (Y/N): ")
	if user_input == 'Y':
		gpu_mem = 0
		while gpu_mem == 0:
			mem_split = raw_input("Enter GPU memory in MB (16/32/64/128/256): ")
			if is_valid_gpu_mem(mem_split):
				gpu_mem = mem_split
			else:
				print("Acceptable memory values are: 16/32/64/128/256")
		update_file('/boot/config.txt', gpu_mem)
	else:
		print("Skipping GPU memory split...")


def update_file(path, gpu_mem):
	data = {
		'gpu_mem': gpu_mem
	}
	template_name = path.split('/')[-1]
	new_file_data = file_templates.build(template_name, data)
	with open(path, 'w') as f:
		f.write(new_file_data)


if __name__ == '__main__':
	main()

Make GPU mem split optional
Make GPU mem split optional

  from utils import file_templates
  from utils.validation import is_valid_gpu_mem
  
  
  def main():
+ 	user_input = raw_input("Want to change the GPU memory split? (Y/N): ")
+ 	if user_input == 'Y':
- 	gpu_mem = 0
+ 		gpu_mem = 0
- 	while gpu_mem == 0:
+ 		while gpu_mem == 0:
- 		user_input = raw_input("Enter GPU memory in MB (16/32/64/128/256): ")
+ 			mem_split = raw_input("Enter GPU memory in MB (16/32/64/128/256): ")
- 		if is_valid_gpu_mem(user_input):
+ 			if is_valid_gpu_mem(mem_split):
- 			gpu_mem = user_input
+ 				gpu_mem = mem_split
- 		else:
+ 			else:
- 			print("Acceptable memory values are: 16/32/64/128/256")
+ 				print("Acceptable memory values are: 16/32/64/128/256")
- 	update_file('/boot/config.txt', gpu_mem)
+ 		update_file('/boot/config.txt', gpu_mem)
+ 	else:
+ 		print("Skipping GPU memory split...")
  
  
  def update_file(path, gpu_mem):
  	data = {
  		'gpu_mem': gpu_mem
  	}
  	template_name = path.split('/')[-1]
  	new_file_data = file_templates.build(template_name, data)
  	with open(path, 'w') as f:
  		f.write(new_file_data)
  
  
  if __name__ == '__main__':
  	main()
  
Make GPU mem split optional
## Code Before:
from utils import file_templates
from utils.validation import is_valid_gpu_mem


def main():
	gpu_mem = 0
	while gpu_mem == 0:
		user_input = raw_input("Enter GPU memory in MB (16/32/64/128/256): ")
		if is_valid_gpu_mem(user_input):
			gpu_mem = user_input
		else:
			print("Acceptable memory values are: 16/32/64/128/256")
	update_file('/boot/config.txt', gpu_mem)


def update_file(path, gpu_mem):
	data = {
		'gpu_mem': gpu_mem
	}
	template_name = path.split('/')[-1]
	new_file_data = file_templates.build(template_name, data)
	with open(path, 'w') as f:
		f.write(new_file_data)


if __name__ == '__main__':
	main()

## Instruction:
Make GPU mem split optional
## Code After:
from utils import file_templates
from utils.validation import is_valid_gpu_mem


def main():
	user_input = raw_input("Want to change the GPU memory split? (Y/N): ")
	if user_input == 'Y':
		gpu_mem = 0
		while gpu_mem == 0:
			mem_split = raw_input("Enter GPU memory in MB (16/32/64/128/256): ")
			if is_valid_gpu_mem(mem_split):
				gpu_mem = mem_split
			else:
				print("Acceptable memory values are: 16/32/64/128/256")
		update_file('/boot/config.txt', gpu_mem)
	else:
		print("Skipping GPU memory split...")


def update_file(path, gpu_mem):
	data = {
		'gpu_mem': gpu_mem
	}
	template_name = path.split('/')[-1]
	new_file_data = file_templates.build(template_name, data)
	with open(path, 'w') as f:
		f.write(new_file_data)


if __name__ == '__main__':
	main()
