MCPcopy Create free account
hub / github.com/Project-MONAI/MONAI / update_to

Method update_to

monai/apps/utils.py:103–112  ·  view source on GitHub ↗

Args: b: number of blocks transferred so far, default: 1. bsize: size of each block (in tqdm units), default: 1. tsize: total size (in tqdm units). if None, remains unchanged.

(self, b: int = 1, bsize: int = 1, tsize: int | None = None)

Source from the content-addressed store, hash-verified

101 """
102
103 def update_to(self, b: int = 1, bsize: int = 1, tsize: int | None = None) -> None:
104 """
105 Args:
106 b: number of blocks transferred so far, default: 1.
107 bsize: size of each block (in tqdm units), default: 1.
108 tsize: total size (in tqdm units). if None, remains unchanged.
109 """
110 if tsize is not None:
111 self.total = tsize
112 self.update(b * bsize - self.n) # will also set self.n = b * bsize
113
114 with TqdmUpTo(unit="B", unit_scale=True, unit_divisor=1024, miniters=1, desc=_basename(filepath)) as t:
115 urlretrieve(url, filepath, reporthook=t.update_to)

Callers

nothing calls this directly

Calls 1

updateMethod · 0.45

Tested by

no test coverage detected