<commit_before>
export function attemptChangeName(obj, name) {
  if (!canRedefineValue(obj, 'name')) {
    return;
  }

  Object.defineProperty(obj, 'name', {
    value: name,
  });
}

export function canRedefineValue(obj, property) {
  const descriptor = Object.getOwnPropertyDescriptor(obj, property);
  return descriptor.configurable || descriptor.writable;
}

function suicide() {
  throw new TypeError('This method does not generate any actions. It cannot be called.');
}

export function killMethod(providerClass, propertyName) {
  replaceMethod(providerClass, propertyName, suicide);
}

export function replaceMethod(clazz, propertyName, replacement) {
  if (!canRedefineValue(clazz, propertyName)) {
    throw new TypeError(`Could not redefine property ${clazz.name}.${propertyName} because it is both non-writable and non-configurable.`);
  }

  Object.defineProperty(clazz, propertyName, { value: replacement });
  attemptChangeName(replacement, propertyName);
}
<commit_msg>Rename generic methods to use generic names<commit_after>export function attemptChangeName(obj, name) {
  if (!canRedefineValue(obj, 'name')) {
    return;
  }

  Object.defineProperty(obj, 'name', {
    value: name,
  });
}

export function canRedefineValue(obj, property) {
  const descriptor = Object.getOwnPropertyDescriptor(obj, property);
  return descriptor.configurable || descriptor.writable;
}

function suicide() {
  throw new TypeError('This method cannot be called.');
}

Object.freeze(suicide);

export function killMethod(Class, propertyName) {
  replaceMethod(Class, propertyName, suicide);
}

export function replaceMethod(clazz, propertyName, replacement) {
  if (!canRedefineValue(clazz, propertyName)) {
    throw new TypeError(`Could not redefine property ${clazz.name}.${propertyName} because it is both non-writable and non-configurable.`);
  }

  Object.defineProperty(clazz, propertyName, { value: replacement });
  attemptChangeName(replacement, propertyName);
}

{'fraction_non_alphanumeric': 0.11398176291793313, 'fraction_numerical': 0.0, 'mean_word_length': 5.62751677852349, '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': '5419026', 'n_tokens_mistral': 562, 'n_tokens_neox': 563, 'n_words': 150}