OLD | NEW |
1 # Copyright 2014 The Chromium Authors. All rights reserved. | 1 # Copyright 2014 The Chromium Authors. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 """Wrappers for gsutil, for basic interaction with Google Cloud Storage.""" | 5 """Wrappers for gsutil, for basic interaction with Google Cloud Storage.""" |
6 | 6 |
7 import collections | 7 import collections |
8 import contextlib | 8 import contextlib |
9 import cStringIO | 9 import cStringIO |
10 import hashlib | 10 import hashlib |
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
296 chunk = f.read(1024*1024) | 296 chunk = f.read(1024*1024) |
297 if not chunk: | 297 if not chunk: |
298 break | 298 break |
299 sha1.update(chunk) | 299 sha1.update(chunk) |
300 return sha1.hexdigest() | 300 return sha1.hexdigest() |
301 | 301 |
302 | 302 |
303 def ReadHash(hash_path): | 303 def ReadHash(hash_path): |
304 with open(hash_path, 'rb') as f: | 304 with open(hash_path, 'rb') as f: |
305 return f.read(1024).rstrip() | 305 return f.read(1024).rstrip() |
OLD | NEW |