<commit_before>/* ========================================================================
 * StorageAPI: index.js v0.0.1
 * Author: <NAME> (@grabbou)
 * Created at: 14/08/2014
 * ========================================================================
 * Description: Abstract StorageAPI client provider. Ensures all of the
 * providers integrated within that package implement all of the required
 * methods. Every package needs to inherit from that abstract one to work.
 * ========================================================================
 */

/* jshint unused: false */

'use strict';

/**
 * Initializes StorageClient, connection and saves config
 * Creates container/folder to use if necessary
 * @param config {Object} containing provider-specific data
 * @param connection {Object} containing reference to connection method
 * @constructor
 */
var StorageClient = function StorageClient(config, connection) {

	if (this.constructor === StorageClient) {
		throw new Error('StorageClient: Cannot initialize abstract class');
	}

	this.__config = config;
	this.__connection = connection;

	this.__ensureContainer(function onEnsured(err) {
		if (err) {
			throw new Error('StorageClient: There was a problem with initialization. Details: ' + err.message);
		}
	});
};

/**
 * Uploads given file
 * @param fileSrc {String} path to the file
 * @param filename {String} name of the file
 * @param callback {Function} to invoke after completing
 * @abstract
 * @access public
 */
StorageClient.prototype.upload = function (fileSrc, filename, callback) {
	throw new Error('Cannot invoke abstract method');
};

/**
 * Removes given file
 * @param filename {String} filename to delete
 * @param callback {Function} to invoke after completing
 * @abstract
 * @access public
 */
StorageClient.prototype.remove = function (filename, callback) {
	throw new Error('Cannot invoke abstract method');
};

/**
 * Downloads given file
 * @param filename {String} to download
 * @param fileSrc {String} path to save the file
 * @param callback {Function} to invoke after downloading
 * @abstract
 * @access public
 */
StorageClient.prototype.download = function (filename, fileSrc, callback) {
	throw new Error('Cannot invoke abstract method');
};

/**
 * Ensures that container/folder we want to use is defined and created
 * @param callback {Function} to be invoked after completion
 * @public
 * @abstract
 * @access protected
 */
StorageClient.prototype.__ensureContainer = function (callback) {
	throw new Error('Cannot invoke abstract method');
};

/**
 * Checks whether config passed is valid
 * @param schema
 * @param config
 * @access protected
 */
StorageClient.prototype.__ensureValid = function (schema, config) {
	schema.forEach(function (key) {<commit_msg>Fixed StorageClient to pass tests<commit_after>/* ========================================================================
 * StorageAPI: index.js v0.0.1
 * Author: <NAME> (@grabbou)
 * Created at: 14/08/2014
 * ========================================================================
 * Description: Abstract StorageAPI client provider. Ensures all of the
 * providers integrated within that package implement all of the required
 * methods. Every package needs to inherit from that abstract one to work.
 * ========================================================================
 */

/* jshint unused: false */

'use strict';

/**
 * Initializes StorageClient, connection and saves config
 * Creates container/folder to use if necessary
 * @param config {Object} containing provider-specific data
 * @param connection {Object} containing reference to connection method
 * @constructor
 */
var StorageClient = function StorageClient(config, connection) {

	if (this.constructor === StorageClient) {
		throw new Error('StorageClient: Cannot initialize abstract class');
	}

	this.__config = config;
	this.__connection = connection;

	this.__ensureContainer(function onEnsured(err) {
		if (err) {
			throw new Error('StorageClient: There was a problem with initialization. Details: ' + err.message);
		}
	});
};

/**
 * Uploads given file
 * @param fileSrc {String} path to the file
 * @param filename {String} name of the file
 * @param callback {Function} to invoke after completing
 * @abstract
 * @access public
 */
StorageClient.prototype.upload = function (fileSrc, filename, callback) {
	throw new Error('Cannot invoke abstract method');
};

/**
 * Removes given file
 * @param filename {String} filename to delete
 * @param callback {Function} to invoke after completing
 * @abstract
 * @access public
 */
StorageClient.prototype.remove = function (filename, callback) {
	throw new Error('Cannot invoke abstract method');
};

/**
 * Downloads given file
 * @param filename {String} to download
 * @param fileSrc {String} path to save the file
 * @param callback {Function} to invoke after downloading
 * @abstract
 * @access public
 */
StorageClient.prototype.download = function (filename, fileSrc, callback) {
	throw new Error('Cannot invoke abstract method');
};

/**
 * Ensures that container/folder we want to use is defined and created
 * @param callback {Function} to be invoked after completion
 * @public
 * @abstract
 * @access protected
 */
StorageClient.prototype.__ensureContainer = function (callback) {
	throw new Error('Cannot invoke abstract method');
};

/**
 * Checks whether config passed is valid
 * @param schema
 * @param config
 * @access protected
 */
StorageClient.prototype.__ensureValid = function (schema, config) {
	if (typeof schema === 'string') schema = [schema];
	schema.forEach(function (key) {
{'fraction_non_alphanumeric': 0.17511602998928955, 'fraction_numerical': 0.003927168868261335, 'mean_word_length': 4.910337552742616, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 8, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '73303', 'n_tokens_mistral': 1413, 'n_tokens_neox': 1346, 'n_words': 534}