<commit_before>define([
	'dojo/request/registry',
	'dojo/_base/lang',
	'dojo/_base/array',
	'dojo/json',
	'dojo/io-query',
	'dojo/_base/declare',
	'./Store'
], function (request, lang, array, JSON, ioQuery, declare, Store) {

	return declare(Store, {
		// summary:
		//		This is a basic store for RESTful communicating with a server through JSON
		//		formatted data. It extends dstore/Store.

		constructor: function () {
			// summary:
			//		This is a basic store for RESTful communicating with a server through JSON
			//		formatted data.
			// options: dstore/JsonRest
			//		This provides any configuration information that will be mixed into the store
			this.headers || (this.headers = {});
		},

		// headers: Object
		//		Additional headers to pass in all requests to the server. These can be overridden
		//		by passing additional headers to calls to the store.
		headers: {},

		// parse: Function
		//		This function performs the parsing of the response text from the server. This
		//		defaults to JSON, but other formats can be parsed by providing an alternate
		//		parsing function. If you do want to use an alternate format, you will probably
		//		want to use an alternate stringify function for the serialization of data as well.
		//		Also, if you want to support parsing a larger set of JavaScript objects
		//		outside of strict JSON parsing, you can provide dojo/_base/json.fromJson as the parse function
		parse: JSON.parse,

		// target: String
		//		The target base URL to use for all requests to the server. This string will be
		//		prepended to the id to generate the URL (relative or absolute) for requests
		//		sent to the server
		target: '',

		// sortParam: String
		//		The query parameter to used for holding sort information. If this is omitted, than
		//		the sort information is included in a functional query token to avoid colliding
		//		with the set of name/value pairs.

		// ascendingPrefix: String
		//		The prefix to apply to sort property names that are ascending
		ascendingPrefix: '+',

		// descendingPrefix: String
		//		The prefix to apply to sort property names that are ascending
		descendingPrefix: '-',

		// accepts: String
		//		Defines the Accept header to use on HTTP requests
		accepts: 'application/json',

		// useRangeHeaders: Boolean
		//		The indicates if range limits (start and end) should be specified
		//		a Range header, using items units. If this is set to true, a header
		//		be included of the form:
		//			Range: items=start-end

		// rangeParam: String
		//		The indicates if range limits (start and end) should be specified
		//		in a query parameter. If this is not specified, the range will
		//		included with a RQL style limit() parameter

		fetch: function () {
			if (!this.hasOwnProperty('data')) {
				// perform the actual query
				var headers = lang.delegate(this.headers, { Accept: this.accepts });
				var ranged = this.ranged;
				if (ranged && this.useRangeHeaders) {
					// use range headers
					headers.Range = headers['X-Range'] //set X-Range for Opera since it blocks "Range" header
						= 'items=' + (ranged.start || '0') + '-' + ((ranged.end || Infinity) - 1);
				}
				var response = request(this._renderUrl(), {
					method: 'GET',
					headers: headers
				});
				var parse = this.parse;
				var store = this;
				this.data = response.then(function (response) {
					var results = parse(response);
					// support items in the results
					results = results.items || results;
					for (var i = 0, l = results.length; i < l; i++) {
						results[i] = store._restore(results[i]);
					}
					return results;<commit_msg>Remove data property if a request fails<commit_after>define([
	'dojo/request/registry',
	'dojo/_base/lang',
	'dojo/_base/array',
	'dojo/json',
	'dojo/io-query',
	'dojo/_base/declare',
	'./Store'
], function (request, lang, array, JSON, ioQuery, declare, Store) {

	return declare(Store, {
		// summary:
		//		This is a basic store for RESTful communicating with a server through JSON
		//		formatted data. It extends dstore/Store.

		constructor: function () {
			// summary:
			//		This is a basic store for RESTful communicating with a server through JSON
			//		formatted data.
			// options: dstore/JsonRest
			//		This provides any configuration information that will be mixed into the store
			this.headers || (this.headers = {});
		},

		// headers: Object
		//		Additional headers to pass in all requests to the server. These can be overridden
		//		by passing additional headers to calls to the store.
		headers: {},

		// parse: Function
		//		This function performs the parsing of the response text from the server. This
		//		defaults to JSON, but other formats can be parsed by providing an alternate
		//		parsing function. If you do want to use an alternate format, you will probably
		//		want to use an alternate stringify function for the serialization of data as well.
		//		Also, if you want to support parsing a larger set of JavaScript objects
		//		outside of strict JSON parsing, you can provide dojo/_base/json.fromJson as the parse function
		parse: JSON.parse,

		// target: String
		//		The target base URL to use for all requests to the server. This string will be
		//		prepended to the id to generate the URL (relative or absolute) for requests
		//		sent to the server
		target: '',

		// sortParam: String
		//		The query parameter to used for holding sort information. If this is omitted, than
		//		the sort information is included in a functional query token to avoid colliding
		//		with the set of name/value pairs.

		// ascendingPrefix: String
		//		The prefix to apply to sort property names that are ascending
		ascendingPrefix: '+',

		// descendingPrefix: String
		//		The prefix to apply to sort property names that are ascending
		descendingPrefix: '-',

		// accepts: String
		//		Defines the Accept header to use on HTTP requests
		accepts: 'application/json',

		// useRangeHeaders: Boolean
		//		The indicates if range limits (start and end) should be specified
		//		a Range header, using items units. If this is set to true, a header
		//		be included of the form:
		//			Range: items=start-end

		// rangeParam: String
		//		The indicates if range limits (start and end) should be specified
		//		in a query parameter. If this is not specified, the range will
		//		included with a RQL style limit() parameter

		fetch: function () {
			if (!this.hasOwnProperty('data')) {
				// perform the actual query
				var headers = lang.delegate(this.headers, { Accept: this.accepts });
				var ranged = this.ranged;
				if (ranged && this.useRangeHeaders) {
					// use range headers
					headers.Range = headers['X-Range'] //set X-Range for Opera since it blocks "Range" header
						= 'items=' + (ranged.start || '0') + '-' + ((ranged.end || Infinity) - 1);
				}
				var response = request(this._renderUrl(), {
					method: 'GET',
					headers: headers
				});
				var parse = this.parse;
				var collection = this;
				this.data = response.then(function (response) {
					var results = parse(response);
					// support items in the results
					results = results.items || results;
					for (var i = 0, l = results.length; i < l; i++) {
						results[i] = collection._restore(results[i]);
					}
					return results;
				});
				this.data.then(null, function () {
					// if there was an error, reset the data, so we could
					// potentially try it again. This could include
					// cancelation
					delete collection.data;
{'fraction_non_alphanumeric': 0.09986666666666667, 'fraction_numerical': 0.0008, 'mean_word_length': 2.838792221084954, 'pattern_counts': {'":': 0, '<': 5, '<?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': '440364', 'n_tokens_mistral': 2492, 'n_tokens_neox': 2120, 'n_words': 904}