@@ -25,7 +25,7 @@ def count_down_delay(delay):
2525 sys .stdout .flush ()
2626 delay -= 1
2727 sleep (1 )
28- print ("" )
28+ print ()
2929
3030
3131DASH_SEPARATOR = 75 * "-"
@@ -297,7 +297,6 @@ def get_default_config(self):
297297 return dict ((opt .name , opt .default ) for opt in self .options )
298298
299299 def read_config_from_pyfile (self , filename ):
300- result = {}
301300 filevars = {}
302301 infile = open (filename )
303302 try :
@@ -307,11 +306,7 @@ def read_config_from_pyfile(self, filename):
307306
308307 exec (compile (contents , filename , "exec" ), filevars )
309308
310- for key , value in filevars .items ():
311- if key in self .optdict :
312- result [key ] = value
313-
314- return result
309+ return {key : value for key , value in filevars .items () if key in self .optdict }
315310
316311 def update_conf_file (self , filename , config ):
317312 result = {}
@@ -324,16 +319,13 @@ def update_conf_file(self, filename, config):
324319
325320 filevars .pop ("__builtins__" , None )
326321
327- for key , value in config .items ():
328- if value is not None :
329- filevars [key ] = value
322+ filevars .update ({key : value for key , value in config .items () if value is not None })
330323
331324 keys = list (filevars .keys ())
332325 keys .sort ()
333326
334327 outf = open (filename , "w" )
335- for key in keys :
336- outf .write ("%s = %s\n " % (key , repr (filevars [key ])))
328+ outf .writelines ("%s = %s\n " % (key , repr (filevars [key ])) for key in keys )
337329 outf .close ()
338330
339331 return result
@@ -520,8 +512,7 @@ def take_from_configparser(self, options):
520512 import re
521513 sep = re .compile (r"(?<!\\)," )
522514 result = sep .split (opt )
523- result = [i .replace (r"\," , "," ) for i in result ]
524- return result
515+ return [i .replace (r"\," , "," ) for i in result ]
525516 else :
526517 return []
527518
@@ -588,9 +579,9 @@ def set_up_shipped_boost_if_requested(project_name, conf, source_path=None,
588579 print ("(The files should be under %s/.)" % source_path )
589580 print (DASH_SEPARATOR )
590581 print ("If you got this package from git, you probably want to do" )
591- print ("" )
582+ print ()
592583 print (" $ git submodule update --init" )
593- print ("" )
584+ print ()
594585 print ("to fetch what you are presently missing. If you got this from" )
595586 print ("a distributed package on the net, that package is broken and" )
596587 print ("should be fixed. For now, I will turn off 'USE_SHIPPED_BOOST'" )
@@ -798,7 +789,7 @@ def _run_git_command(cmd):
798789 print (DASH_SEPARATOR )
799790 print ("The package directory appears to be a git repository, but I could" )
800791 print ("not invoke git to check whether my submodules are up to date." )
801- print ("" )
792+ print ()
802793 print ("The error was:" )
803794 print (git_error )
804795 print ("Hit Ctrl-C now if you'd like to think about the situation." )
@@ -855,20 +846,20 @@ def check_git_submodules():
855846 print ("git submodules are not up-to-date or in odd state" )
856847 print (DASH_SEPARATOR )
857848 print ("If this makes no sense, you probably want to say" )
858- print ("" )
849+ print ()
859850 print (" $ git submodule update --init" )
860- print ("" )
851+ print ()
861852 print ("to fetch what you are presently missing and "
862853 "move on with your life." )
863854 print ("If you got this from a distributed package on the "
864855 "net, that package is" )
865856 print ("broken and should be fixed. Please inform whoever "
866857 "gave you this package." )
867- print ("" )
858+ print ()
868859 print ("These issues were found:" )
869860 for w in pkg_warnings :
870861 print (" %s" % w )
871- print ("" )
862+ print ()
872863 print ("I will try to initialize the submodules for you "
873864 "after a short wait." )
874865 print (DASH_SEPARATOR )
@@ -898,12 +889,12 @@ def check_pybind11():
898889 print ("Pybind11 is not installed." )
899890 print (DASH_SEPARATOR )
900891 print ("Very likely, the build process after this message will fail." )
901- print ("" )
892+ print ()
902893 print ("Simply press Ctrl+C and type" )
903894 print ("python -m pip install pybind11" )
904895 print ("to fix this. If you don't, the build will continue " )
905896 print ("in a few seconds." )
906- print ("" )
897+ print ()
907898 print ("[1] https://pybind11.readthedocs.io/en/stable/" )
908899 print (DASH_SEPARATOR )
909900
0 commit comments