class_docstr: A helper class for displaying progress.
class_docstr_tok: ["A","helper","class","for","displaying","progress","."]
docstr: Read bytes and call the callback.
docstr_tok: ["Read","bytes","and","call","the","callback","."]
code: def read(self, size=-1):
      """Read bytes and call the callback."""
      bites = self.file.read(size)
      self.bytes_read += len(bites)
      if not bites and self.bytes_read < self.len:
          # Files shrinking during uploads causes request timeouts. Maybe
          # we could avoid those by updating the self.len in real-time, but
          # files getting truncated while uploading seems like something
          # that shouldn't really be happening anyway.
          raise CommError(
              "File {} size shrank from {} to {} while it was being uploaded.".format(
                  self.file.name, self.len, self.bytes_read
              )
          )
      # Growing files are also likely to be bad, but our code didn't break
      # on those in the past, so it's riskier to make that an error now.
      self.callback(len(bites), self.bytes_read)
      return bites
  
file_path: wandb/wandb/sdk/internal/progress.py
imports: import os
  import sys
  from typing import IO, TYPE_CHECKING, Optional
  from wandb.errors import CommError
label_desc: Use image node_id 2 for calling the Progress obj's underlying member method code with example usage: obj.read(size) and returns: bites