<commit_before>import functools

from merc import emitter


class MessageTooLongError(Exception):
  pass


class Message(object):
  MAX_LENGTH = 510
  FORCE_TRAILING = False

  def emit(self, client, prefix):
    emitted = emitter.emit_message(prefix, self.NAME, self.as_params(client),
                                   force_trailing=self.FORCE_TRAILING)

    if len(emitted) > self.MAX_LENGTH:
      raise MessageTooLongError

    return emitted

  def as_params(self, client):
    raise NotImplementedError

  @classmethod
  def with_params(cls, params):
    from merc import errors
<commit_msg>Update message.py<commit_after>import functools

from merc import emitter


class MessageTooLongError(Exception):
  pass


class Message(object):
  MAX_LENGTH = 510
  FORCE_TRAILING = False

  def emit(self, client, prefix):
    emitted = emitter.emit_message(prefix, self.NAME, self.as_params(client),
                                   force_trailing=self.FORCE_TRAILING)

    if len(emitted) > self.MAX_LENGTH:
      raise MessageTooLongError

    return emitted

  def as_params(self, client):
    raise NotImplementedError

  def can_send_to(self, client):
    return True

  @classmethod
  def with_params(cls, params):
    from merc import errors

{'fraction_non_alphanumeric': 0.07256778309409888, 'fraction_numerical': 0.004784688995215311, 'mean_word_length': 3.3127147766323026, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '714223', 'n_tokens_mistral': 400, 'n_tokens_neox': 370, 'n_words': 94}