<commit_before>class Selector(object):

    def __init__(self):
        self._table = None
        self._view = None
        self.position = (0, 0)

    def setup(self, table, view):
        self._table = table
        self._view = view

    def move(self, di, dj):
        i, j = self.position
        self.position = (i + di, j + dj)

    def draw(self, pad):
        raise AssertionError("Not implemented")

    def draw_instructions(self, pad):
        pass

    def clear(self, pad):
        pass

    def handle_input(self, c):
        raise AssertionError("Not implemented")<commit_msg>[bugfix] Restrain movement inside table<commit_after>from utils import limit


class Selector(object):

    def __init__(self):
        self._table = None
        self._view = None
        self.position = (0, 0)

    def setup(self, table, view):
        self._table = table
        self._view = view

    def move(self, di, dj):
        i, j = self.position
        i = limit(i + di, 0, self._table.height - 1)
        j = limit(j + dj, 0, len(self._table.table[i]) - 1)
        self.position = (i, j)

    def draw(self, pad):
        raise AssertionError("Not implemented")

    def draw_instructions(self, pad):
        pass

    def clear(self, pad):
        pass

    def handle_input(self, c):
        raise AssertionError("Not implemented")
{'fraction_non_alphanumeric': 0.11483967188665176, 'fraction_numerical': 0.005965697240865026, 'mean_word_length': 2.1576470588235295, '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': '7281503', 'n_tokens_mistral': 430, 'n_tokens_neox': 407, 'n_words': 119}