<commit_before>import fs from 'fs'
import path from 'path'
import utils from 'fs-utils'
import { flow, sortBy, uniq } from 'lodash'
import config from '../../config/server'
import Permissions from '../services/Permissions'

export default class Profile {
  static get default() {
    return {
      id:    undefined,
      email: '',
      name:  '',

      privileges: ['read'],
    }
  }

  static delete(id) {
    // Removes files only. Reference updates are performed in response to file watchers.
    const filepath = path.resolve(config.folders.users, `${id}.json`)
    if (utils.exists(filepath)) {
      fs.unlinkSync(filepath, { force: true })
    }

    return true
  }

  static load(id) {
    if (!id) return Profile.default<commit_msg>Adding exists utility for Profiles<commit_after>import fs from 'fs'
import path from 'path'
import utils from 'fs-utils'
import { flow, sortBy, uniq } from 'lodash'
import config from '../../config/server'
import Permissions from '../services/Permissions'

export default class Profile {
  static get default() {
    return {
      id:    undefined,
      email: '',
      name:  '',

      privileges: ['read'],
    }
  }

  static delete(id) {
    // Removes files only. Reference updates are performed in response to file watchers.
    const filepath = path.resolve(config.folders.users, `${id}.json`)
    if (utils.exists(filepath)) {
      fs.unlinkSync(filepath, { force: true })
    }

    return true
  }

  static exists(id) {
    if (!id) return false
    const filepath = path.resolve(config.folders.users, `${id}.json`)
    return utils.exists(filepath)
  }

  static load(id) {
    if (!id) return Profile.default
{'fraction_non_alphanumeric': 0.12843488649940263, 'fraction_numerical': 0.0, 'mean_word_length': 2.931924882629108, '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': '6019505', 'n_tokens_mistral': 509, 'n_tokens_neox': 510, 'n_words': 157}