@@ -181,7 +181,7 @@ def test_allow_extraneous_files_in_base(self):
181181 bag = bagit .make_bag (self .tmpdir )
182182 self .assertTrue (self .validate (bag ))
183183 f = j (self .tmpdir , "IGNOREFILE" )
184- with open (f , 'w' ) as whatever :
184+ with open (f , 'w' ):
185185 self .assertTrue (self .validate (bag ))
186186
187187 def test_allow_extraneous_dirs_in_base (self ):
@@ -206,7 +206,7 @@ def test_missing_manifest_raises_error(self):
206206 def test_mixed_case_checksums (self ):
207207 bag = bagit .make_bag (self .tmpdir )
208208 hashstr = {}
209- #Extract entries only for the payload and ignore
209+ # Extract entries only for the payload and ignore
210210 # entries from the tagmanifest file
211211 for key in bag .entries .keys ():
212212 if key .startswith ('data' + os .sep ):
@@ -218,7 +218,7 @@ def test_mixed_case_checksums(self):
218218 with open (j (self .tmpdir , "manifest-md5.txt" ), "w" ) as m :
219219 m .write (manifest )
220220
221- #Since manifest-md5.txt file is updated, re-calculate its
221+ # Since manifest-md5.txt file is updated, re-calculate its
222222 # md5 checksum and update it in the tagmanifest-md5.txt file
223223 hasher = hashlib .new ('md5' )
224224 with open (j (self .tmpdir , "manifest-md5.txt" ), "r" ) as manifest :
@@ -300,7 +300,7 @@ def tearDown(self):
300300
301301 def test_make_bag (self ):
302302 info = {
'Bagging-Date' :
'1970-01-01' ,
'Contact-Email' :
'[email protected] ' }
303- bag = bagit .make_bag (self .tmpdir , bag_info = info )
303+ bagit .make_bag (self .tmpdir , bag_info = info )
304304
305305 # data dir should've been created
306306 self .assertTrue (os .path .isdir (j (self .tmpdir , 'data' )))
@@ -340,7 +340,7 @@ def test_make_bag(self):
340340 self .assertTrue ('6a5090e27cb29d5dda8a0142fbbdf37e bag-info.txt' in tagmanifest_txt )
341341
342342 def test_make_bag_sha1_manifest (self ):
343- bag = bagit .make_bag (self .tmpdir , checksum = ['sha1' ])
343+ bagit .make_bag (self .tmpdir , checksum = ['sha1' ])
344344 # check manifest
345345 self .assertTrue (os .path .isfile (j (self .tmpdir , 'manifest-sha1.txt' )))
346346 with open (j (self .tmpdir , 'manifest-sha1.txt' )) as m :
@@ -352,7 +352,7 @@ def test_make_bag_sha1_manifest(self):
352352 self .assertTrue ('db49ef009f85a5d0701829f38d29f8cf9c5df2ea data/si/4011399822_65987a4806_b_d.jpg' in manifest_txt )
353353
354354 def test_make_bag_sha256_manifest (self ):
355- bag = bagit .make_bag (self .tmpdir , checksum = ['sha256' ])
355+ bagit .make_bag (self .tmpdir , checksum = ['sha256' ])
356356 # check manifest
357357 self .assertTrue (os .path .isfile (j (self .tmpdir , 'manifest-sha256.txt' )))
358358 with open (j (self .tmpdir , 'manifest-sha256.txt' )) as m :
@@ -363,7 +363,7 @@ def test_make_bag_sha256_manifest(self):
363363 self .assertTrue ('45d257c93e59ec35187c6a34c8e62e72c3e9cfbb548984d6f6e8deb84bac41f4 data/si/4011399822_65987a4806_b_d.jpg' in manifest_txt )
364364
365365 def test_make_bag_sha512_manifest (self ):
366- bag = bagit .make_bag (self .tmpdir , checksum = ['sha512' ])
366+ bagit .make_bag (self .tmpdir , checksum = ['sha512' ])
367367 # check manifest
368368 self .assertTrue (os .path .isfile (j (self .tmpdir , 'manifest-sha512.txt' )))
369369 with open (j (self .tmpdir , 'manifest-sha512.txt' )) as m :
@@ -378,7 +378,7 @@ def test_make_bag_unknown_algorithm(self):
378378
379379 def test_make_bag_with_data_dir_present (self ):
380380 os .mkdir (j (self .tmpdir , 'data' ))
381- bag = bagit .make_bag (self .tmpdir )
381+ bagit .make_bag (self .tmpdir )
382382
383383 # data dir should now contain another data dir
384384 self .assertTrue (os .path .isdir (j (self .tmpdir , 'data' , 'data' )))
@@ -425,7 +425,7 @@ def test_garbage_in_bagit_txt(self):
425425 self .assertRaises (bagit .BagValidationError , bagit .Bag , self .tmpdir )
426426
427427 def test_make_bag_multiprocessing (self ):
428- bag = bagit .make_bag (self .tmpdir , processes = 2 )
428+ bagit .make_bag (self .tmpdir , processes = 2 )
429429 self .assertTrue (os .path .isdir (j (self .tmpdir , 'data' )))
430430
431431 def test_multiple_meta_values (self ):
@@ -437,7 +437,7 @@ def test_multiple_meta_values(self):
437437
438438 def test_default_bagging_date (self ):
439439 info = {
'Contact-Email' :
'[email protected] ' }
440- bag = bagit .make_bag (self .tmpdir , bag_info = info )
440+ bagit .make_bag (self .tmpdir , bag_info = info )
441441 with open (j (self .tmpdir , 'bag-info.txt' )) as bi :
442442 bag_info_txt = bi .read ()
443443 self .
assertTrue (
'Contact-Email: [email protected] ' in bag_info_txt )
@@ -468,7 +468,7 @@ def test_payload_permissions(self):
468468 new_perms = perms | stat .S_IWOTH
469469 self .assertTrue (perms != new_perms )
470470 os .chmod (self .tmpdir , new_perms )
471- bag = bagit .make_bag (self .tmpdir )
471+ bagit .make_bag (self .tmpdir )
472472 payload_dir = j (self .tmpdir , 'data' )
473473 self .assertEqual (os .stat (payload_dir ).st_mode , new_perms )
474474
@@ -515,7 +515,7 @@ def test_save_only_baginfo(self):
515515 nf .write ('newfile' )
516516 bag .info ["foo" ] = "bar"
517517 bag .save ()
518-
518+
519519 bag = bagit .Bag (self .tmpdir )
520520 self .assertEqual (bag .info ["foo" ], "bar" )
521521 self .assertFalse (bag .is_valid ())
0 commit comments