<commit_before># -*- coding: utf-8 -*-:
from markdown.treeprocessors import Treeprocessor
from markdown.extensions import Extension
from markdown.util import etree

from django.core.urlresolvers import reverse
import re


REPLACE1_REXP = re.compile(r'[\':\?\!,/\.\+\&]+', re.UNICODE)
REPLACE2_REXP = re.compile(r'[^-\w%]', re.UNICODE)


def github_slugify(text):
    if text is None:
        return text
    text = text.encode('utf-8')
    from urllib import quote_plus
    text = REPLACE1_REXP.sub('', text)
    text = quote_plus(text)
    text = REPLACE2_REXP.sub('-', text.lower())
    return text


def get_unique_slug(slug, all_slugs):
    """
    Iterates until a unique slug is found
    """
    counter = 1
    orig_slug = slug

    while True:
        if slug not in all_slugs:
            return slug
<commit_msg>Close #33<commit_after># -*- coding: utf-8 -*-:
from markdown.treeprocessors import Treeprocessor
from markdown.extensions import Extension
from markdown.util import etree

from django.core.urlresolvers import reverse
import re


REPLACE1_REXP = re.compile(r'[\':\?\!,/\.\+\&]+', re.UNICODE)
REPLACE2_REXP = re.compile(r'[\(]', re.UNICODE)
REPLACE3_REXP = re.compile(r'[\)]', re.UNICODE)
REPLACE4_REXP = re.compile(r'[^-\w%]', re.UNICODE)


def github_slugify(text):
    if text is None:
        return text
    text = text.encode('utf-8')
    from urllib import quote_plus
    text = REPLACE1_REXP.sub('', text)
    text = quote_plus(text)
    text = REPLACE2_REXP.sub('%28', text)
    text = REPLACE3_REXP.sub('%29', text)
    text = REPLACE4_REXP.sub('-', text.lower())
    return text


def get_unique_slug(slug, all_slugs):
    """
    Iterates until a unique slug is found
    """
    counter = 1
    orig_slug = slug

    while True:
        if slug not in all_slugs:
            return slug

{'fraction_non_alphanumeric': 0.13666300768386389, 'fraction_numerical': 0.013172338090010977, 'mean_word_length': 3.1244343891402715, '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': '7038143', 'n_tokens_mistral': 705, 'n_tokens_neox': 667, 'n_words': 161}