Source

data_munging_code_kata / kutil / dry.py

class BaseFileDifferentialObject():

	def _load_file(self , file_path):
		return open(file_path,'r')
		
	def eval_row(self,row):
		pass
	def is_row_data(self,row):
		pass
		
	def eval_spread(self, file_path):
		file = self._load_file(file_path)
		flag_value = None
		min_diff = None
		for line in file:
			row = line.split()
			if self.is_row_data(row):
				diff_dict = self.eval_row(row)
				if not min_diff or min_diff > diff_dict[1]:
						min_diff = diff_dict[1]
						flag_value =  diff_dict[0]
		
		return flag_value