<commit_before>var Promise			= require( "bluebird" );
var readFileAsync	= Promise.promisify( require( "fs" ).readFile );
var path			= require( "path" );

var CPUInterface = function()
{
	var self = this;
};

CPUInterface.prototype.Compose = function( platform )
{
	// Temporary container used for cpu detection and info loading
	var cpu =
	{
		targetCPU: platform.cpu
	};
	
	var self = this;

	// Compose the CPU interface object
	return self.LoadInfo( cpu )
			.then( self.CheckSupport )
			.then( self.LoadInterfaceImplementation );
};

CPUInterface.prototype.LoadInfo = function( cpu )
{
	return Promise.try( function()
			{
				cpu.info = 
				{
					revision: "123MOCK",
					serial: "1234567890"
				}
				
				return cpu;
			} )
			.catch( function( error )
			{
				console.log( error );
			} );
}

CPUInterface.prototype.CheckSupport = function( cpu )
{
	return readFileAsync( path.resolve( __dirname, "cpu/revisionInfo.json" ) )
			.then( JSON.parse )
			.then( function( json )
			{
				// Lookup cpu details in the raspi json file, based on revision
				var details = json[ cpu.info.revision ];
				
				if( details !== undefined )
				{	
					// Board is supported. Add the retrieved details to the interface object
					for( var prop in details )
					{
						cpu.info[ prop ] = details[ prop ];
					}
					
					// Add the info to the target CPU Interface
					cpu.targetCPU.info = cpu.info;
			
					return cpu;
				}
				else
				{
					throw new Error( "Board doesn't exist in database." );
				}<commit_msg>Fixed mock cpu interface composer<commit_after>var Promise			= require( "bluebird" );
var readFileAsync	= Promise.promisify( require( "fs" ).readFile );
var path			= require( "path" );

var CPUInterface = function()
{
	var self = this;
};

CPUInterface.prototype.Compose = function( platform )
{
	// Temporary container used for cpu detection and info loading
	var cpu =
	{
		targetCPU: platform.cpu
	};
	
	var self = this;

	// Compose the CPU interface object
	return self.LoadInfo( cpu )
			.then( self.CheckSupport )
			.then( self.LoadInterfaceImplementation );
};

CPUInterface.prototype.LoadInfo = function( cpu )
{
	return Promise.try( function()
			{
				cpu.info = 
				{
					revision: "123MOCK",
					serial: "1234567890"
				}
				
				return cpu;
			} );
}

CPUInterface.prototype.CheckSupport = function( cpu )
{
	return readFileAsync( path.resolve( __dirname, "cpu/revisionInfo.json" ) )
			.then( JSON.parse )
			.then( function( json )
			{
				// Lookup cpu details in the raspi json file, based on revision
				var details = json[ cpu.info.revision ];
				
				if( details !== undefined )
				{	
					// Board is supported. Add the retrieved details to the interface object
					for( var prop in details )
					{
						cpu.info[ prop ] = details[ prop ];
					}
					
					// Add the info to the target CPU Interface
					cpu.targetCPU.info = cpu.info;
			
					return cpu;
				}
				else
				{
					throw new Error( "Board doesn't exist in database." );
				}
{'fraction_non_alphanumeric': 0.11273694712337878, 'fraction_numerical': 0.008646491519787164, 'mean_word_length': 2.580952380952381, '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': '4041093', 'n_tokens_mistral': 1196, 'n_tokens_neox': 927, 'n_words': 281}