Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/C/Firefox/third_party/python/dlmanager/examples/   (Firefox Browser Version 153.0.1©)  Datei vom 27.6.2026 mit Größe 1 kB image not shown  

Quelle  dl_tqdm.py

  Sprache: Python
 

import argparse
import tqdm

from six.moves.urllib.parse import urlparse

from dlmanager import Download


def parse_args(argv=None):
    parser = argparse.ArgumentParser()
    parser.add_argument("url", help="url to download")
    return parser.parse_args(argv)


def download_progress(bar):
    last_b = [0]

    def inner(_, current, total):
        if total is not None:
            bar.total = total
        delta = current - last_b[0]
        last_b[0] = current

        if delta > 0:
            bar.update(delta)
    return inner


def download_file(url, dest=None):
    if dest is None:
        dest = urlparse(url).path.split('/')[-1]

    with tqdm.tqdm(unit='B', unit_scale=True, miniters=1, dynamic_ncols=True,
                   desc=dest) as bar:
        dl = Download(url, dest, progress=download_progress(bar))
        dl.start()
        dl.wait()


if __name__ == '__main__':
    options = parse_args()
    try:
        download_file(options.url)
    except KeyboardInterrupt:
        print("\nInterrupted.")

Messung V0.5 in Prozent
C=93 H=97 G=94

¤ Dauer der Verarbeitung: 0.3 Sekunden  ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

PVS Prover

Isabelle Prover

NIST Cobol Testsuite

Cephes Mathematical Library

Vienna Development Method

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.