d9cf79a6f4746a794755e2e6837b3d45f74ac042,scanpy/readwrite.py,,_download,#Any#Any#,915

Before Change


                total=total if total is None else int(total),
            ) as t, path.open("wb") as f:
                for chunk in resp.iter_content(chunk_size=8 * 1024):
                    t.update(len(chunk))
                    f.write(chunk)
    except (KeyboardInterrupt, Exception):
        // Make sure file doesn’t exist half-downloaded
        if path.is_file():

After Change



    from urllib.request import urlopen, Request

    blocksize = 1024 * 8
    blocknum = 0

    try:
        with urlopen(Request(url, headers={"User-agent": "scanpy-user"})) as resp:
            total = resp.info().get("content-length", None)
            with tqdm(
                unit="B",
                unit_scale=True,
                miniters=1,
                unit_divisor=1024,
                total=total if total is None else int(total),
            ) as t, path.open("wb") as f:
                block = resp.read(blocksize)
                while block:
                    f.write(block)
                    blocknum += 1
                    t.update(blocknum * blocksize - t.n)
                    block = resp.read(blocksize)

    except (KeyboardInterrupt, Exception):
        // Make sure file doesn’t exist half-downloaded
        if path.is_file():
            path.unlink()
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 4

Non-data size: 4

Instances


Project Name: theislab/scanpy
Commit Name: d9cf79a6f4746a794755e2e6837b3d45f74ac042
Time: 2020-11-25
Author: michal.klein@protonmail.com
File Name: scanpy/readwrite.py
Class Name:
Method Name: _download


Project Name: AIRLab-POLIMI/mushroom
Commit Name: f251f0e71071f12ebc0f6671b9f0978655196ee1
Time: 2021-02-16
Author: carlo.deramo@gmail.com
File Name: mushroom_rl/utils/replay_memory.py
Class Name: SumTree
Method Name: add


Project Name: biolab/orange3
Commit Name: 46598f5fd6b35acf43c155570e98148eb47780c0
Time: 2020-02-14
Author: tomaz.hocevar@fri.uni-lj.si
File Name: Orange/data/util.py
Class Name:
Method Name: get_unique_names_duplicates


Project Name: theislab/scanpy
Commit Name: d9cf79a6f4746a794755e2e6837b3d45f74ac042
Time: 2020-11-25
Author: michal.klein@protonmail.com
File Name: scanpy/readwrite.py
Class Name:
Method Name: _download


Project Name: pantsbuild/pants
Commit Name: 076e01d237ab3b58cdb395fb04a7f176ab02209d
Time: 2013-10-31
Author: benjy@foursquare.com
File Name: src/python/twitter/pants/base/hash_utils.py
Class Name:
Method Name: hash_file