def loadOutput(self, outputFile=None): """ Load a MEASURE job from the output file located at `outputFile`, or from the `outputFile` attribute if not given as a parameter. """ from input import readFile # If an input file is specified, then it overrides the inputFile attribute if outputFile is not None: self.outputFile = outputFile # No matter where we got the input filename, make sure that it exists if not os.path.exists(self.outputFile): raise PDepError('Output file "{0}" does not exist.'.format(self.outputFile)) # Load the data from the output file readFile(self.outputFile, self)
def main(): passwords = readFile("inputs/day2.txt") downTheStreet = [PasswordDownTheStreet(p) for p in passwords] print(countValids(downTheStreet)) toboggans = [Toboggan(p) for p in passwords] print(countValids(toboggans))
def loadInput(self, inputFile=None): """ Load a MEASURE job from the input file located at `inputFile`, or from the `inputFile` attribute if not given as a parameter. """ from input import readFile # If an input file is specified, then it overrides the inputFile attribute if inputFile is not None: self.inputFile = inputFile # No matter where we got the input filename, make sure that it exists if not os.path.exists(self.inputFile): raise PDepError('Input file "{0}" does not exist.'.format(self.inputFile)) # Set locations of log and output files to be in same folder as input file # (unless already set previously) inputDirectory = os.path.dirname(os.path.relpath(self.inputFile)) if not self.outputFile: self.outputFile = os.path.join(inputDirectory, 'output.py') if not self.logFile: self.logFile = os.path.join(inputDirectory, 'MEASURE.log') # Load the data from the input file readFile(self.inputFile, self)
# get file in the directory fileList = input.getFileList(path,fileExt) #loop through file and do the desired modification for file in fileList: fileName = os.path.splitext(file) currentPath = path+file cLine = [] cLine.append('%mem=80000MB\n') cLine.append('%nprocshared=10\n') cLine.append('%chk=' + fileName[0] + '.chk\n') if fileExt == '.com': #read file and extract coordinate coordLine = input.readFile(currentPath) elif fileExt == '.log': coordLine = input.readLogFile(currentPath) else: raise Exception('Something went wrong') for i in range(0,nConformation): #Generate conformation optModRedundant = makeConformation(dhToMod, method) name = 'conformation0' + str(i) #Make Input file according to input input.makeInputFile(currentPath, cLine, calcLine, comment, charge, coordLine, optModRedundant, freeze, name)
def main(): seats = readFile("inputs/day5.txt") print(findHighest(seats)) findMissing(seats)