File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1010import hashlib
1111import os
1212import sys
13-
1413from functools import partial
1514
1615from commoncode import filetype
@@ -32,6 +31,7 @@ class Hashable:
3231 """
3332 A mixin for hashers that provides the base methods.
3433 """
34+
3535 # digest_size = length of binary digest for this hash
3636 # binh = binary hasher module
3737 # msg_len = length in bytes of the messages hashed
@@ -259,7 +259,7 @@ def sha1_git(location):
259259 return checksum (location , name = "sha1_git" , base64 = False )
260260
261261
262- def binary_chunks (location , size = 2 ** 24 ):
262+ def binary_chunks (location , size = 2 ** 24 ):
263263 """
264264 Read file at ``location`` as binary and yield bytes of up to ``size`` length in bytes,
265265 defaulting to 2**24 bytes, e.g., about 16 MB.
Original file line number Diff line number Diff line change 66# See https://aboutcode.org for more information about nexB OSS projects.
77#
88
9- import os
109import hashlib
10+ import os
1111
1212from commoncode .hash import b64sha1
1313from commoncode .hash import checksum
@@ -180,7 +180,9 @@ def test_sha1_git_checksum(self):
180180 def test_checksum_from_chunks_can_stream_gigabytes (self ):
181181 chunk_16mb = b"0" * 16000000
182182 chunks_3dot2gb = (chunk_16mb for _ in range (200 ))
183- result = checksum_from_chunks (chunks = chunks_3dot2gb , total_length = 16000000 * 200 , name = "sha1_git" )
183+ result = checksum_from_chunks (
184+ chunks = chunks_3dot2gb , total_length = 16000000 * 200 , name = "sha1_git"
185+ )
184186 assert result == "494caf26c43c4473f6e930b0f5c2ecf8121bcf24"
185187
186188 def test_checksum_from_chunks_from_stream_is_same_as_plain (self ):
You can’t perform that action at this time.
0 commit comments