+CONF = '''
+[DEFAULT]
+search = 'files'
+outtype = 'outtable'
+
+[files]
+ignore_dirs = ['/dev', '/proc', '/sys', '/mnt']
+start_path = '.'
+count = 5
+
+[debs]
+count = 12
+'''
+
+from ConfigParser import ConfigParser, NoOptionError
+
+class FindITConfig(ConfigParser):
+ def __init__(self, config):
+ ConfigParser.__init__(self)
+ if isinstance(config, basestring):
+ self.read(config)
+ else:
+ self.readfp(config)
+ self._section = None
+
+ def __getitem__(self, item):
+ try:
+ return self.get('DEFAULT', item)
+ except NoOptionError:
+ if self.has_section(item):
+ self._section = item
+ return self
+ else:
+ return self.get(self._section, item)
+
+ def __setitem__(self, item, value):
+ return self.set(self._section, item, str(value))
+
+ def get(self, section, option):
+ value = ConfigParser.get(self, section, option)
+ try:
+ return eval(value)
+ except SyntaxError:
+ return value
+
+from StringIO import StringIO
+config = FindITConfig(StringIO(CONF))