1 from __future__
import print_function
4 import pprint
as pprint
7 """Loads a list of strings from file. Will append to given list
10 filename = os.path.expanduser (filename)
11 if not os.path.exists (filename):
12 print(
"Error: file '%s' does not exist."%(filename))
13 raise RuntimeError(
"Bad filename")
14 source = open (filename,
'r')
15 for line
in source.readlines():
16 line = re.sub (
r'#.+$',
'', line)
25 """Returns the appropriate sublist given the current section
28 size = len (inputList)
29 perSection = size // numSections
30 extra = size % numSections
31 start = perSection * currentSection
33 if currentSection < extra:
35 start += currentSection
40 return inputList[ start:stop ]
50 if __name__ ==
"__main__":
57 historyPath = os.path.expanduser(
"~/.pyhistory")
62 readline.write_history_file(historyPath)
63 if os.path.exists(historyPath):
64 readline.read_history_file(historyPath)
67 atexit.register(save_history)
68 readline.parse_and_bind(
"set show-all-if-ambiguous on")
69 readline.parse_and_bind(
"tab: complete")
70 if os.path.exists (historyPath) :
71 readline.read_history_file(historyPath)
72 readline.set_history_length(-1)