<commit_before>from hashids import Hashids


class Shortener(object):

    def __init__(self, secret, min_length, short_url_domain):
        self.secret = secret
        self.min_length = min_length
        self.short_url_domain = short_url_domain
        self._hasher = None

    def get_short_id(self, number):
        if self._hasher is None:
            self._hasher = Hashids(self.secret, self.min_length)
        return self._hasher.encode(number)

    def get_short_url(self, short_id):
        return f'http://{self.short_url_domain}/{short_id}'<commit_msg>Move hasher creation to constructor<commit_after>from hashids import Hashids


class Shortener(object):

    def __init__(self, secret, min_length, short_url_domain):
        self.secret = secret
        self.min_length = min_length
        self.short_url_domain = short_url_domain
        self._hasher = Hashids(self.secret, self.min_length)

    def get_short_id(self, number):
        return self._hasher.encode(number)

    def get_short_url(self, short_id):
        return f'http://{self.short_url_domain}/{short_id}'
{'fraction_non_alphanumeric': 0.09199632014719411, 'fraction_numerical': 0.0, 'mean_word_length': 3.283464566929134, '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': '7083235', 'n_tokens_mistral': 344, 'n_tokens_neox': 335, 'n_words': 69}