quantnn/data.py
def run(self):
        """
        Open dataset and start loading batches.
        """
        super().run()
        while True:

            filename = self.task_queue.get()

            if filename is None:
                break

            try:
                dataset = self.factory(filename, *self.args, **self.kwargs)
                if isinstance(dataset, Iterable):
                    for b in dataset:
                        self.batch_queue.put(b)
                elif (hasattr(dataset, "__len__") and
                        hasattr(dataset, "__getitem__")):
                    for i in range(len(dataset)):
                        self.batch_queue.put(dataset[i])
                else:
                    raise TypeError(
                        "Provided dataset is neither iterable nor does it "
                        "implement '__getitem__' and '__len__' methods."
                    )
            except Exception as e:
                _LOGGER.error("Error encountered in dataset loader: %s", e)
            self.done_queue.put(filename)

        Open dataset and start loading batches.
        
Open dataset and start loading batches.
Open dataset and start loading batches .
def run(self):
        super().run()
        while True:
            filename = self.task_queue.get()
            if filename is None:
                break
            try:
                dataset = self.factory(filename, *self.args, **self.kwargs)
                if isinstance(dataset, Iterable):
                    for b in dataset:
                        self.batch_queue.put(b)
                elif (hasattr(dataset, "__len__") and
                        hasattr(dataset, "__getitem__")):
                    for i in range(len(dataset)):
                        self.batch_queue.put(dataset[i])
                else:
                    raise TypeError(
                        "Provided dataset is neither iterable nor does it "
                        "implement '__getitem__' and '__len__' methods."
                    )
            except Exception as e:
                _LOGGER.error("Error encountered in dataset loader: %s", e)
            self.done_queue.put(filename)
def run ( self ) : super ( ) . run ( ) while True : filename = self . task_queue . get ( ) if filename is None : break try : dataset = self . factory ( filename , * self . args , ** self . kwargs ) if isinstance ( dataset , Iterable ) : for b in dataset : self . batch_queue . put ( b ) elif ( hasattr ( dataset , "__len__" ) and hasattr ( dataset , "__getitem__" ) ) : for i in range ( len ( dataset ) ) : self . batch_queue . put ( dataset [ i ] ) else : raise TypeError ( "Provided dataset is neither iterable nor does it " "implement '__getitem__' and '__len__' methods." ) except Exception as e : _LOGGER . error ( "Error encountered in dataset loader: %s" , e ) self . done_queue . put ( filename )
Open dataset and start loading batches.
Open dataset and start loading batches .
"""
        Open dataset and start loading batches.
        """
self