37ef2c69f22a6e2d1232782dd3e192a003731a75,scanpy/readwrite.py,,_download,#Any#Any#,915

Before Change


            t.total = int(resp.info().get("content-length", 0))

            block = resp.read(blocksize)
            while block:
                f.write(block)
                blocknum += 1
                t.update(blocknum * blocksize - t.n)
                block = resp.read(blocksize)
        // fmt: on
    except Exception:
        // Make sure file doesn’t exist half-downloaded
        if path.is_file():
            path.unlink()

After Change


            url, headers={"User-agent": "scanpy-user"}, stream=True
        ) as resp:
            resp.raise_for_status()
            total = resp.headers.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:
                for chunk in resp.iter_content(chunk_size=8 * 1024):
                    t.update(len(chunk))
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 7

Instances


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


Project Name: NVIDIA/OpenSeq2Seq
Commit Name: 42ad0f227fa39fe9b96bc3e08b2e5704dc157e74
Time: 2018-06-26
Author: xravitejax@gmail.com
File Name: open_seq2seq/encoders/w2l_encoder.py
Class Name: Wave2LetterEncoder
Method Name: _encode


Project Name: facebookresearch/pytext
Commit Name: 5a8868024c4ece64611ae75107b00b66e0892684
Time: 2019-05-24
Author: snl@fb.com
File Name: pytext/data/data.py
Class Name: Data
Method Name: batches