<commit_before>from gitlabform.gitlab.core import GitLabCore


class GitLabMergeRequests(GitLabCore):

    def create_mr(self, project_and_group_name, source_branch, target_branch, title, description=None):
        pid = self._get_project_id(project_and_group_name)
        data = {
            "id": pid,
            "source_branch": source_branch,
            "target_branch": target_branch,
            "title": title,
            "description": description,
        }
        return self._make_requests_to_api("projects/%s/merge_requests" % pid, method='POST', data=data,
                                          expected_codes=201)

    def accept_mr(self, project_and_group_name, mr_id):  # NOT iid, like API docs suggest!
        pid = self._get_project_id(project_and_group_name)
        return self._make_requests_to_api("projects/%s/merge_request/%s/merge" % (pid, mr_id), method='PUT')

    def update_mr(self, project_and_group_name, mr_id, data):  # NOT iid, like API docs suggest!
        pid = self._get_project_id(project_and_group_name)
        self._make_requests_to_api("projects/%s/merge_request/%s" % (pid, mr_id), method='PUT', data=data)

    def get_mrs(self, project_and_group_name):
        pid = self._get_project_id(project_and_group_name)
        return self._make_requests_to_api("projects/%s/merge_requests" % pid, paginated=True)<commit_msg>Add getting a single MR<commit_after>from gitlabform.gitlab.core import GitLabCore


class GitLabMergeRequests(GitLabCore):

    def create_mr(self, project_and_group_name, source_branch, target_branch, title, description=None):
        pid = self._get_project_id(project_and_group_name)
        data = {
            "id": pid,
            "source_branch": source_branch,
            "target_branch": target_branch,
            "title": title,
            "description": description,
        }
        return self._make_requests_to_api("projects/%s/merge_requests" % pid, method='POST', data=data,
                                          expected_codes=201)

    def accept_mr(self, project_and_group_name, mr_id):  # NOT iid, like API docs suggest!
        pid = self._get_project_id(project_and_group_name)
        return self._make_requests_to_api("projects/%s/merge_request/%s/merge" % (pid, mr_id), method='PUT')

    def update_mr(self, project_and_group_name, mr_id, data):  # NOT iid, like API docs suggest!
        pid = self._get_project_id(project_and_group_name)
        self._make_requests_to_api("projects/%s/merge_request/%s" % (pid, mr_id), method='PUT', data=data)

    def get_mrs(self, project_and_group_name):
        pid = self._get_project_id(project_and_group_name)
        return self._make_requests_to_api("projects/%s/merge_requests" % pid, paginated=True)

    def get_mr(self, project_and_group_name, mr_id):  # NOT iid, like API docs suggest!
        pid = self._get_project_id(project_and_group_name)
        return self._make_requests_to_api("projects/%s/merge_requests/%s" % (pid, mr_id))
{'fraction_non_alphanumeric': 0.1048064085447263, 'fraction_numerical': 0.0020026702269692926, 'mean_word_length': 3.4008810572687223, 'pattern_counts': {'":': 10, '<': 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': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3205137', 'n_tokens_mistral': 970, 'n_tokens_neox': 942, 'n_words': 171}