Status of a resumable upload.
| 230 | |
| 231 | |
| 232 | class MediaUploadProgress(object): |
| 233 | """Status of a resumable upload.""" |
| 234 | |
| 235 | def __init__(self, resumable_progress, total_size): |
| 236 | """Constructor. |
| 237 | |
| 238 | Args: |
| 239 | resumable_progress: int, bytes sent so far. |
| 240 | total_size: int, total bytes in complete upload, or None if the total |
| 241 | upload size isn't known ahead of time. |
| 242 | """ |
| 243 | self.resumable_progress = resumable_progress |
| 244 | self.total_size = total_size |
| 245 | |
| 246 | def progress(self): |
| 247 | """Percent of upload completed, as a float. |
| 248 | |
| 249 | Returns: |
| 250 | the percentage complete as a float, returning 0.0 if the total size of |
| 251 | the upload is unknown. |
| 252 | """ |
| 253 | if self.total_size is not None and self.total_size != 0: |
| 254 | return float(self.resumable_progress) / float(self.total_size) |
| 255 | else: |
| 256 | return 0.0 |
| 257 | |
| 258 | |
| 259 | class MediaDownloadProgress(object): |
no outgoing calls
no test coverage detected
searching dependent graphs…