<commit_before>import numpy as np
import matplotlib.pyplot as plt

from .time_index import TimeIndex
from .utils import is_scalar

class InfiniteSequence:

    def __init__(self, fun):
        self.fun = fun

    def __getitem__(self, n):
        if n == int(n):
            return self.fun(n)
        else:
            raise Exception("Index to a sequence must be an integer.")

    def __call__(self, n):
        return self.__getitem__(n)

    def __repr__(self):
        return "InfiniteSequence"

    def __str__(self):
        return str(tuple([self.fun(n) for n in range(10)] + ["..."]))

class TimeFunction:

    def __init__(self, fun, timeIndex):
        self.fun = fun
        self.timeIndex = timeIndex

    def __getitem__(self, t):
        return self.fun(t)

    def __call__(self, t):
        return self.fun(t)

    def __str__(self):
        if self.timeIndex.fs == float("inf"):
            return "(continuous-time function)"
        else:
            return str(tuple([self.fun(self.timeIndex[n]) for n in range(10)] + ["..."]))
<commit_msg>print out first few terms of InfiniteSequences<commit_after>import numpy as np
import matplotlib.pyplot as plt

from .time_index import TimeIndex
from .utils import is_scalar

class InfiniteSequence:

    def __init__(self, fun):
        self.fun = fun

    def __getitem__(self, n):
        if n == int(n):
            return self.fun(n)
        else:
            raise Exception("Index to a sequence must be an integer.")

    def __call__(self, n):
        return self.__getitem__(n)

    def __repr__(self):
        return self.__str__()

    def __str__(self):
        return str(tuple([self.fun(n) for n in range(10)] + ["..."]))

class TimeFunction:

    def __init__(self, fun, timeIndex):
        self.fun = fun
        self.timeIndex = timeIndex

    def __getitem__(self, t):
        return self.fun(t)

    def __call__(self, t):
        return self.fun(t)

    def __str__(self):
        if self.timeIndex.fs == float("inf"):
            return "(continuous-time function)"
        else:
            return str(tuple([self.fun(self.timeIndex[n]) for n in range(10)] + ["..."]))

{'fraction_non_alphanumeric': 0.12029725963771482, 'fraction_numerical': 0.0037157454714352067, 'mean_word_length': 2.3551401869158877, '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': '5180253', 'n_tokens_mistral': 672, 'n_tokens_neox': 651, 'n_words': 192}