#NEWLINE# def readArgsFromFile( taskoutpath ) : #NEWLINE# #INDENT# ' Read args as key/val pairs from plain-text file\n      so that we can figure out what settings were used for a saved run\n  ' #NEWLINE# import json #NEWLINE# import glob #NEWLINE# KwArgs = dict ( ) #NEWLINE# for argfilepath in glob . glob ( os . path . join ( taskoutpath , 'args-*.txt' ) ) : #NEWLINE# #INDENT# pathparts = argfilepath . split ( os . path . sep ) #NEWLINE# curKey = pathparts [ ( - 1 ) ] . split ( '-' ) [ 1 ] . split ( '.txt' ) [ 0 ] #NEWLINE# with open ( argfilepath , 'r' ) as f : #NEWLINE# #INDENT# curDict = json . load ( f ) #NEWLINE# #UNINDENT# KwArgs [ curKey ] = curDict #NEWLINE# #UNINDENT# return ( KwArgs , dict ( ) )