<commit_before>from ..messages import RepoHook
from ..requests import RepoHookResponse
from ..requests import RepoHookListResponse

class ReposHooks:
  def __init__(self, client):
    self.client = client

  def list_hooks(self, repo, user=None):
    return self.client.get(
      'repos/%s/%s/hooks' % (
        self.client.user(user), repo), msg_type=RepoHookListResponse)

  def get_hook(self, repo, id, user=None):
    return self.client.get(
      'repos/%s/%s/hooks/%s' % (
        self.client.user(user), repo, id), msg_type=RepoHookResponse)

  def create_hook(self, repo, name, config, events=None, active=True,
      user=None):
    msg = RepoHook(
      name=name,
      config=config,
      events=events,
      active=active)
    return self.client.post(
      'repos/%s/%s/hooks' % (
        self.client.user(user), repo), msg)

  def edit_hook(self, repo, id, name=None, config=None, events=None,
      add_events=None, remove_events=None, active=True, user=None):
    msg = RepoHook(
      name=name,
      config=config,
      active=active,
      events=events or [],
      add_events=add_events or [],
      remove_events=remove_events or [])
    return self.client.patch(
      'repos/%s/%s/hooks/%s' % (
        self.client.user(user), repo, id), msg)

  def test_hook(self, repo, id, user=None):
    return self.client.post(
      'repos/%s/%s/hooks/%s/test' % (
        self.client.user(user), repo, id))
<commit_msg>debugging hooks installation<commit_after>from ..messages import RepoHook
from ..requests import RepoHookResponse
from ..requests import RepoHookListResponse

class ReposHooks:
  def __init__(self, client):
    self.client = client

  def list_hooks(self, repo, user=None):
    return self.client.get(
      'repos/%s/%s/hooks' % (
        self.client.user(user), repo), msg_type=RepoHookListResponse)

  def get_hook(self, repo, id, user=None):
    return self.client.get(
      'repos/%s/%s/hooks/%s' % (
        self.client.user(user), repo, id), msg_type=RepoHookResponse)

  def create_hook(self, repo, name, config, events=None, active=True,
      user=None):
    msg = RepoHook(
      name=name,
      config=config,
      events=events,
      active=active)
    return self.client.post(
      'repos/%s/%s/hooks' % (
        self.client.user(user), repo), data=msg, msg_type=RepoHook)

  def edit_hook(self, repo, id, name=None, config=None, events=None,
      add_events=None, remove_events=None, active=True, user=None):
    msg = RepoHook(
      name=name,
      config=config,
      active=active,
      events=events or [],
      add_events=add_events or [],
      remove_events=remove_events or [])
    return self.client.patch(
      'repos/%s/%s/hooks/%s' % (
        self.client.user(user), repo, id), data=msg, msg_type=RepoHook)

  def test_hook(self, repo, id, user=None):
    return self.client.post(
      'repos/%s/%s/hooks/%s/test' % (
        self.client.user(user), repo, id))

{'fraction_non_alphanumeric': 0.14339109751953788, 'fraction_numerical': 0.0, 'mean_word_length': 3.1174825174825176, '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': '7543791', 'n_tokens_mistral': 998, 'n_tokens_neox': 995, 'n_words': 206}