@@ -125,11 +125,8 @@ def count_files(self):
125
125
126
126
return len (self .get_files ())
127
127
128
- def _sort_hash_list (self ):
129
- self ._hash_list = sorted (self ._hash_list , key = lambda x : x [0 ] + x [1 ])
130
-
131
128
def generate (self , progress = None ):
132
- """Generate the Data Integrity Fingerprint.
129
+ """Generate hash list to get Data Integrity Fingerprint.
133
130
134
131
Parameters
135
132
----------
@@ -142,15 +139,15 @@ def generate(self, progress=None):
142
139
143
140
"""
144
141
145
- self . _hash_list = []
142
+ hash_list = []
146
143
147
144
if os .path .isfile (self ._data ):
148
145
# from checksum file
149
146
with codecs .open (self ._data , encoding = "utf-8" ) as f :
150
147
for line in f :
151
148
h , fl = line .split (self .CHECKSUM_FILENAME_SEPARATOR ,
152
149
maxsplit = 1 )
153
- self . _hash_list .append ((h , fl .strip ()))
150
+ hash_list .append ((h , fl .strip ()))
154
151
else :
155
152
files = self .get_files ()
156
153
func_args = zip (files , [self ._hash_algorithm ] * len (files ))
@@ -164,9 +161,9 @@ def generate(self, progress=None):
164
161
progress (counter + 1 , len (files ),
165
162
"{0}/{1}" .format (counter + 1 , len (files )))
166
163
fl = os .path .relpath (rtn [1 ], self .data ).replace (os .path .sep ,"/" )
167
- self . _hash_list .append ((rtn [0 ], fl ))
164
+ hash_list .append ((rtn [0 ], fl ))
168
165
169
- self ._sort_hash_list ( )
166
+ self ._hash_list = sorted ( hash_list , key = lambda x : x [ 0 ] + x [ 1 ] )
170
167
171
168
def save_checksums (self , filename = None ):
172
169
"""Save the checksums to a file.
0 commit comments