INNER CODE UNIT · Python

TqdmUpTo

NirantK/NLP_Quickbook · Part-08 Web Deployments/utils.py:11

class TqdmUpTo(tqdm):
    def update_to(self, b=1, bsize=1, tsize=None):
        if tsize is not None:
            self.total = tsize
        self.update(b * bsize - self.n)


def get_data(url, filename):
    """
    Download data if the filename does not exist already
    Uses Tqdm to show download progress
    """
    if not os.path.exists(filename):

        dirname = os.path.dirname(filename)
        if not os.path.exists(dirname):
            os.makedirs(dirname)

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…