<commit_before>/**
 * class representing the archive of object metadata.
 *
 * @class
 */
class ObjectMDArchive {
    /**
     *
     * @constructor
     * @param {Object} archiveInfo contains the archive info set by the TLP and returned by the TLP jobs
     * @param {Date} [restoreRequestedAt] set at the time restore request is made by the client
     * @param {Number} [restoreRequestedDays] set at the time restore request is made by the client
     * @param {Date} [restoreCompletedAt] set at the time of successful restore
     * @param {Date} [restoreWillExpireAt] computed and stored at the time of restore
     * @throws {Error} case of invalid parameter
     */
    constructor(
        archiveInfo,
        restoreRequestedAt = undefined,
        restoreRequestedDays = undefined,
        restoreCompletedAt = undefined,
        restoreWillExpireAt = undefined
    ) {
        this.setArchiveInfo(archiveInfo);
        this.setRestoreRequestedAt(restoreRequestedAt);
        this.setRestoreRequestedDays(restoreRequestedDays);
        this.setRestoreCompletedAt(restoreCompletedAt);
        this.setRestoreWillExpireAt(restoreWillExpireAt);
    }

    /**
     *
     * @param {Object} data archiveInfo
     * @returns {boolean} true if the provided object is valid
     */
    static isValid(data) {
        try {
            new ObjectMDArchive(
                data.archiveInfo,
                data.restoreRequestedAt,
                data.restoreRequestedDays,
                data.restoreCompletedAt,
                data.restoreWillExpireAt,
            );
            return true;
        } catch (err) {
            return false;
        }
    }

    /**
     *
     * @returns {Object} archiveInfo
     */
    getArchiveInfo() {
        return this.archiveInfo;<commit_msg>ARSN-177: better isValid for class<commit_after>/**
 * class representing the archive of object metadata.
 *
 * @class
 */
class ObjectMDArchive {
    /**
     *
     * @constructor
     * @param {Object} archiveInfo contains the archive info set by the TLP and returned by the TLP jobs
     * @param {Date} [restoreRequestedAt] set at the time restore request is made by the client
     * @param {Number} [restoreRequestedDays] set at the time restore request is made by the client
     * @param {Date} [restoreCompletedAt] set at the time of successful restore
     * @param {Date} [restoreWillExpireAt] computed and stored at the time of restore
     * @throws {Error} case of invalid parameter
     */
    constructor(
        archiveInfo,
        restoreRequestedAt = undefined,
        restoreRequestedDays = undefined,
        restoreCompletedAt = undefined,
        restoreWillExpireAt = undefined,
    ) {
        this.setArchiveInfo(archiveInfo);
        this.setRestoreRequestedAt(restoreRequestedAt);
        this.setRestoreRequestedDays(restoreRequestedDays);
        this.setRestoreCompletedAt(restoreCompletedAt);
        this.setRestoreWillExpireAt(restoreWillExpireAt);
    }

    /**
     *
     * @param {Object} data archiveInfo
     * @returns {boolean} true if the provided object is valid
     */
    static isValid(data) {
        try {
            const object = new ObjectMDArchive(
                data.archiveInfo,
                data.restoreRequestedAt,
                data.restoreRequestedDays,
                data.restoreCompletedAt,
                data.restoreWillExpireAt,
            );
            return !!object;
        } catch (err) {
            return false;
        }
    }

    /**
     *
     * @returns {Object} archiveInfo
     */
    getArchiveInfo() {
        return this.archiveInfo;
{'fraction_non_alphanumeric': 0.07876618011567062, 'fraction_numerical': 0.0008262186725419994, 'mean_word_length': 2.251566696508505, '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': '3283484', 'n_tokens_mistral': 975, 'n_tokens_neox': 939, 'n_words': 273}