This repository was archived by the owner on Feb 26, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +4
-8
lines changed
Expand file tree Collapse file tree 2 files changed +4
-8
lines changed Original file line number Diff line number Diff line change @@ -123,8 +123,7 @@ def eaAlphaMuPlusLambdaCheckpoint(
123123
124124 if continue_cp :
125125 # A file name has been given, then load the data from the file
126- with open (cp_filename , "rb" ) as f :
127- cp = pickle .load (f )
126+ cp = pickle .load (open (cp_filename , "rb" ))
128127 population = cp ["population" ]
129128 parents = cp ["parents" ]
130129 start_gen = cp ["generation" ]
@@ -186,8 +185,7 @@ def eaAlphaMuPlusLambdaCheckpoint(
186185 logbook = logbook ,
187186 rndstate = random .getstate (),
188187 param_names = param_names )
189- with open (cp_filename_tmp , "wb" ) as f :
190- pickle .dump (cp , f )
188+ pickle .dump (cp , open (cp_filename_tmp , "wb" ))
191189 if os .path .isfile (cp_filename_tmp ):
192190 shutil .copy (cp_filename_tmp , cp_filename )
193191 logger .debug ('Wrote checkpoint to %s' , cp_filename )
Original file line number Diff line number Diff line change @@ -265,8 +265,7 @@ def run(
265265 if continue_cp :
266266
267267 # A file name has been given, then load the data from the file
268- with open (cp_filename , "rb" ) as f :
269- cp = pickle .load (f )
268+ cp = pickle .load (open (cp_filename , "rb" ))
270269 gen = cp ["generation" ]
271270 self .hof = cp ["halloffame" ]
272271 logbook = cp ["logbook" ]
@@ -362,8 +361,7 @@ def run(
362361 CMA_es = CMA_es ,
363362 param_names = param_names ,
364363 )
365- with open (cp_filename_tmp , "wb" ) as f :
366- pickle .dump (cp , f )
364+ pickle .dump (cp , open (cp_filename_tmp , "wb" ))
367365 if os .path .isfile (cp_filename_tmp ):
368366 shutil .copy (cp_filename_tmp , cp_filename )
369367 logger .debug ("Wrote checkpoint to %s" , cp_filename )
You can’t perform that action at this time.
0 commit comments