You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@libcloud.apache.org by an...@apache.org on 2017/01/13 03:30:31 UTC
[04/10] libcloud git commit: tidy up hashing algo method
tidy up hashing algo method
Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/42c58a46
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/42c58a46
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/42c58a46
Branch: refs/heads/trunk
Commit: 42c58a4635d9d7b66e9b9f3b8d8cd9f889866fe1
Parents: 4c1fff0
Author: Anthony Shaw <an...@apache.org>
Authored: Fri Jan 13 13:18:56 2017 +1100
Committer: Anthony Shaw <an...@apache.org>
Committed: Fri Jan 13 13:18:56 2017 +1100
----------------------------------------------------------------------
libcloud/storage/base.py | 10 ++--------
1 file changed, 2 insertions(+), 8 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/libcloud/blob/42c58a46/libcloud/storage/base.py
----------------------------------------------------------------------
diff --git a/libcloud/storage/base.py b/libcloud/storage/base.py
index 233cc25..6db1d4d 100644
--- a/libcloud/storage/base.py
+++ b/libcloud/storage/base.py
@@ -650,20 +650,14 @@ class StorageDriver(BaseDriver):
return (hasher.hexdigest(), total_len)
if not hasattr(stream, '__exit__'):
for s in stream:
- if isinstance(s, str):
- hasher.update(s)
- else:
- hasher.update(s)
+ hasher.update(s)
total_len = total_len + len(s)
return (hasher.hexdigest(), total_len)
with stream:
buf = stream.read(blocksize)
while len(buf) > 0:
total_len = total_len + len(buf)
- if isinstance(buf, str):
- hasher.update(buf)
- else:
- hasher.update(buf)
+ hasher.update(buf)
buf = stream.read(blocksize)
return (hasher.hexdigest(), total_len)