1 """ @file ConfigTools.py 2 Defines the CrombieTools.ConfigTools package 3 @author Daniel Abercrombie <dabercro@mit.edu> 5 @package CrombieTools.ConfigTools 6 These are quick parsers for the FileConfigs for minor things that might be needed in Python. 7 @todo Use an actual FileConfigReader in here. 11 from collections
import defaultdict
13 FileLists = defaultdict(
lambda: [])
20 split_line = in_line.lstrip(
'#').
split()
21 self.
saved =
not in_line.startswith(
'#')
22 self.
treename = split_line[0]
if split_line[0] !=
'.' else Line.lasttree
24 self.
xs = split_line[2]
25 self.
entry = split_line[3]
if split_line[3] !=
'.' else Line.lastentry
26 self.
color =
' '.join(split_line[4:])
if split_line[4] !=
'.' else Line.lastcolor
30 Line.lastentry = self.
entry 31 Line.lastcolor = self.
color 35 """Get list of tree names from a config file 37 @param args are the file locations of the Configuration file to read the tree lists from 43 if not os.path.exists(config):
44 print '%s does not exist!' % config
47 with open(config,
'r') as in_file: 48 for in_line
in in_file.readlines():
50 split_line = in_line.split()
54 treename = raw.lstrip(
'#')
59 FileLists[lastname].append(split_line[1])