<commit_before>import Request from './request';
import {Container} from './';

export default class Resource {
	/**
	 * @param {Object} params
	 */
	constructor({service, name, identifierName, collectionRoot, itemRoot}) {
		this.service = service;
		this.name = name;
		this.identifierName = identifierName;
		this.collectionRoot = collectionRoot;
		this.itemRoot = itemRoot;

		this.descriptor = Container.get(this.service);

		this.attributes = {};

		this.parentResource = null;
	}

	/**
	 * @returns {bool}
	 */
	hasParentResource() {
		return this.parentResource !== null;
	}

	/**
	 * @param {Resource} resource
	 * @return {Resource}
	 */
	childResource(resource) {
		resource.parentResource = this;

		return resource;
	}

	/**
	 * @returns {?string}
	 */
	getIdentifier() {
		return this.get(this.identifierName) || null;
	}

	/**
	 * @param {string} key
	 * @returns {*}
	 */
	get(key) {
		return this.attributes[key];
	}

	/**
	 * @param {string|Object} key
	 * @param {?*} value
	 */
	set(arg1, value = null) {
		if (typeof arg1 === 'object') {
			const values = arg1;

			for (const key of Object.keys(values)) {
				this.attributes[key] = values[key];
			}
		} else {
			const key = arg1;

			this.attributes[key] = value;
		}
	}
<commit_msg>Resource returns self after .set()<commit_after>import Request from './request';
import {Container} from './';

export default class Resource {
	/**
	 * @param {Object} params
	 */
	constructor({service, name, identifierName, collectionRoot, itemRoot}) {
		this.service = service;
		this.name = name;
		this.identifierName = identifierName;
		this.collectionRoot = collectionRoot;
		this.itemRoot = itemRoot;

		this.descriptor = Container.get(this.service);

		this.attributes = {};

		this.parentResource = null;
	}

	/**
	 * @returns {bool}
	 */
	hasParentResource() {
		return this.parentResource !== null;
	}

	/**
	 * @param {Resource} resource
	 * @return {Resource}
	 */
	childResource(resource) {
		resource.parentResource = this;

		return resource;
	}

	/**
	 * @returns {?string}
	 */
	getIdentifier() {
		return this.get(this.identifierName) || null;
	}

	/**
	 * @param {string} key
	 * @returns {*}
	 */
	get(key) {
		return this.attributes[key];
	}

	/**
	 * @param {string|Object} key
	 * @param {?*} value
	 * @returns {Resource}
	 */
	set(arg1, value = null) {
		if (typeof arg1 === 'object') {
			const values = arg1;

			for (const key of Object.keys(values)) {
				this.attributes[key] = values[key];
			}
		} else {
			const key = arg1;

			this.attributes[key] = value;
		}

		return this;
	}

{'fraction_non_alphanumeric': 0.16090167120093277, 'fraction_numerical': 0.003109211037699184, 'mean_word_length': 3.219672131147541, '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': '2173449', 'n_tokens_mistral': 946, 'n_tokens_neox': 832, 'n_words': 190}