comparison python/storage.py @ 382:ba813f148ade

development for clustering
author Nicolas Saunier <nicolas.saunier@polymtl.ca>
date Sun, 21 Jul 2013 10:23:15 -0400
parents 2aed569f39e7
children 12be4a0cb9aa
comparison
equal deleted inserted replaced
381:387cc0142211 382:ba813f148ade
15 15
16 ######################### 16 #########################
17 # Sqlite 17 # Sqlite
18 ######################### 18 #########################
19 19
20 def saveTrajectoriesToSqlite(objects, outFilename, trajectoryType, objectNumbers = -1): 20 def writeTrajectoriesToSqlite(objects, outFilename, trajectoryType, objectNumbers = -1):
21 """ 21 """
22 This function writers trajectories to a specified sqlite file 22 This function writers trajectories to a specified sqlite file
23 @param[in] objects -> a list of trajectories 23 @param[in] objects -> a list of trajectories
24 @param[in] trajectoryType - 24 @param[in] trajectoryType -
25 @param[out] outFile -> the .sqlite file containting the written objects 25 @param[out] outFile -> the .sqlite file containting the written objects
400 f = utils.openCheck(filename, 'w') 400 f = utils.openCheck(filename, 'w')
401 for x in l: 401 for x in l:
402 f.write('{}\n'.format(x)) 402 f.write('{}\n'.format(x))
403 f.close() 403 f.close()
404 404
405 def loadListStrings(filename):
406 f = utils.openCheck(filename, 'r')
407 result = [l.strip() for l in f]
408 f.close()
409 return result
410
411
405 if __name__ == "__main__": 412 if __name__ == "__main__":
406 import doctest 413 import doctest
407 import unittest 414 import unittest
408 suite = doctest.DocFileSuite('tests/storage.txt') 415 suite = doctest.DocFileSuite('tests/storage.txt')
409 unittest.TextTestRunner().run(suite) 416 unittest.TextTestRunner().run(suite)