"""Generator for Data"""

class GeneratorData:
    def __init__(self, data_source=None):
        self.data = []
        if data_source is not None:
            self.load_data(data_source)
    
    def load_data(self, source):
        if isinstance(source, list):
            self.data.extend(source)
        elif hasattr(source, 'read'):
            for line in source:
                self.data.append(line.strip())
        else:
            raise ValueError("Unsupported data source type")
    
    def generate_batches(self, batch_size=10):
        n_samples = len(self.data)
        indices = list(range(n_samples))
        
        while True:
            if not indices:  # Reset indices when they are exhausted
                indices = list(range(n_samples))