<commit_before>/*******************************************************************************
 * @license
 * Copyright (c) 2012 VMware, Inc. All Rights Reserved.
 * THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE
 * ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE
 * CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT.
 * You can obtain a current copy of the Eclipse Public License from
 * http://www.opensource.org/licenses/eclipse-1.0.php
 *
 * Contributors:
 *     <NAME> - initial API and implementation
 ******************************************************************************/
if (typeof define !== 'function') {
    var define = require('amdefine')(module);
}
define(function(require, exports, module) {

	var mime = require('rest/interceptor/mime');
	var errorCode = require('rest/interceptor/errorCode');
	var entity = require('rest/interceptor/entity');
	
	function unreject(client, value) {
		return function (x) {
			return client(x).otherwise(function (err) {
				console.error(err);
				return value;
			});
		};
	}
	
	var baseClient = entity(
		mime(
			errorCode(),
			{
				mime: 'application/json'
			}
		)
	);
	
	var putClient = unreject(baseClient);
	var getClient = unreject(baseClient, {});

	exports.getScriptedRcFile = function (name) {
		return getClient({
			path: '/config/{name}',
			params: {
				name: name
			}
		}).otherwise(function (err) {
			console.error(err);
			return {};
		});
	};
	
	exports.putScriptedRcFile = function (name, contents) {
		return putClient({
			path: '/config/{name}',
			method: 'put',
			params: {
				name: name
			},
			entity: contents
		});
	};
});
<commit_msg>Better names for put and get rest clients<commit_after>/*******************************************************************************
 * @license
 * Copyright (c) 2012 VMware, Inc. All Rights Reserved.
 * THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE
 * ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE
 * CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT.
 * You can obtain a current copy of the Eclipse Public License from
 * http://www.opensource.org/licenses/eclipse-1.0.php
 *
 * Contributors:
 *     <NAME> - initial API and implementation
 ******************************************************************************/
if (typeof define !== 'function') {
    var define = require('amdefine')(module);
}
define(function(require, exports, module) {

	var mime = require('rest/interceptor/mime');
	var errorCode = require('rest/interceptor/errorCode');
	var entity = require('rest/interceptor/entity');
	
	function unreject(client, value) {
		return function (x) {
			return client(x).otherwise(function (err) {
				console.error(err);
				return value;
			});
		};
	}
	
	var baseClient = entity(
		mime(
			errorCode(),
			{
				mime: 'application/json'
			}
		)
	);
	
	var put = unreject(baseClient);
	var get = unreject(baseClient, {});

	exports.getScriptedRcFile = function (name) {
		return get({
			path: '/config/{name}',
			params: {
				name: name
			}
		});
	};
	
	exports.putScriptedRcFile = function (name, contents) {
		return put({
			path: '/config/{name}',
			method: 'put',
			params: {
				name: name
			},
			entity: contents
		});
	};
});

{'fraction_non_alphanumeric': 0.22079902409271118, 'fraction_numerical': 0.0036596523330283625, 'mean_word_length': 3.9397590361445785, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '3818967', 'n_tokens_mistral': 1125, 'n_tokens_neox': 959, 'n_words': 261}