<commit_before>/**
 * Permission checker
 */
class Permitter {
  /**
   * Creates a new Permitter instance
   * @arg {Client} Client instance
   */
  constructor (client) {
    this._client = client
  }

  static get contexts () {
    return ['members', 'roles', 'channels']
  }

  static isBoolean (val) {
    return val === true || val === false
  }

  static hasWildcard (obj) {
    return obj !== null && '*' in obj ? this.isBoolean(obj['*']) : false
  }

  /**
   * Verifies if a command has permission to be executed
   * @arg {String} node The permission node
   * @arg {external:"Eris.Message"} message The command message
   * @arg {Object} perms The permissions map
   * @arg {Boolean} [defaultValue=true] The default result
   */
  static verifyMessage (node, msg, perms = {}, defVal = true) {
    if (!msg.channel.guild) return true
    let res = this.check(`${msg.channel.id}.${msg.author.id}.${node}`, perms)
    if (this.isBoolean(res)) return res

    for (const perm of msg.member.roles.map(r => `${msg.channel.id}.${r}.${node}`)) {
      res = this.check(perm, perms)
      if (this.isBoolean(res)) return res
    }

    res = this.check(`*.${msg.author.id}.${node}`, perms)
    if (this.isBoolean(res)) return res

    for (const perm of msg.member.roles.map(r => `*.${r}.${node}`)) {
      res = this.check(perm, perms)
      if (this.isBoolean(res)) return res
    }

    res = this.check(`${msg.channel.id}.${node}`, perms)
    if (this.isBoolean(res)) return res

    res = this.check(`*.*.${node}`, perms)
    if (this.isBoolean(res)) return res

    return defVal
  }

  /**
   * Checks if a node is allowed
   * @arg {String} node The permission node
   * @arg {Object} perms THe permissions map
   */<commit_msg>Fix static reference in Permitter<commit_after>/**
 * Permission checker
 */
class Permitter {
  /**
   * Creates a new Permitter instance
   * @arg {Client} Client instance
   */
  constructor (client) {
    this._client = client
  }

  static get contexts () {
    return ['members', 'roles', 'channels']
  }

  static isBoolean (val) {
    return val === true || val === false
  }

  static hasWildcard (obj) {
    return obj !== null && '*' in obj ? this.isBoolean(obj['*']) : false
  }

  /**
   * Verifies if a command has permission to be executed
   * @arg {String} node The permission node
   * @arg {external:"Eris.Message"} message The command message
   * @arg {Object} perms The permissions map
   * @arg {Boolean} [defaultValue=true] The default result
   */
  static verifyMessage (node, msg, perms = {}, defVal = true) {
    if (!msg.channel.guild) return true
    let res = Permitter.check(`${msg.channel.id}.${msg.author.id}.${node}`, perms)
    if (this.isBoolean(res)) return res

    for (const perm of msg.member.roles.map(r => `${msg.channel.id}.${r}.${node}`)) {
      res = Permitter.check(perm, perms)
      if (this.isBoolean(res)) return res
    }

    res = Permitter.check(`*.${msg.author.id}.${node}`, perms)
    if (this.isBoolean(res)) return res

    for (const perm of msg.member.roles.map(r => `*.${r}.${node}`)) {
      res = Permitter.check(perm, perms)
      if (this.isBoolean(res)) return res
    }

    res = Permitter.check(`${msg.channel.id}.${node}`, perms)
    if (this.isBoolean(res)) return res

    res = Permitter.check(`*.*.${node}`, perms)
    if (this.isBoolean(res)) return res

    return defVal
  }

  /**
   * Checks if a node is allowed
   * @arg {String} node The permission node
   * @arg {Object} perms THe permissions map
   */
{'fraction_non_alphanumeric': 0.1649659863945578, 'fraction_numerical': 0.0, 'mean_word_length': 2.9785794813979707, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, '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': '7210309', 'n_tokens_mistral': 1178, 'n_tokens_neox': 1153, 'n_words': 328}