home *** CD-ROM | disk | FTP | other *** search
Wrap
# Source Generated with Decompyle++ # File: in.pyc (Python 2.6) import exceptions import os from pprint import pprint from IPython import ultraTB from IPython.ipstruct import Struct from IPython.genutils import * class ConfigLoaderError(exceptions.Exception): def __init__(self, args = None): self.args = args class ConfigLoader: def __init__(self, conflict = None, field_sep = None, reclimit = 15): self.conflict = conflict self.field_sep = field_sep self.reset(reclimit) def reset(self, reclimit = 15): self.reclimit = reclimit self.recdepth = 0 self.included = [] def load(self, fname, convert = None, recurse_key = '', incpath = '.', **kw): if self.recdepth > self.reclimit: raise ConfigLoaderError, 'maximum recursive inclusion of rcfiles ' + 'exceeded: ' + `self.recdepth` + '.\nMaybe you have a circular chain of inclusions?' self.recdepth > self.reclimit self.recdepth += 1 fname = filefind(fname, incpath) data = Struct() if fname in self.included: return data Xinfo = ultraTB.AutoFormattedTB(color_scheme = 'NoColor') data.merge(read_dict(fname, convert, fs = self.field_sep, strip = 1, warn = 0, no_empty = 0, **kw)) self.included.append(fname) if recurse_key in data: for incfilename in data[recurse_key]: found = 0 try: incfile = filefind(incfilename, incpath) except IOError: None if convert == None and recurse_key else self None if convert == None and recurse_key else self if os.name in ('nt', 'dos'): try: incfilename += '.ini' incfile = filefind(incfilename, incpath) except IOError: found = 0 found = 1 else: found = 0 except: os.name in ('nt', 'dos') found = 1 if found: try: data.merge(self.load(incfile, convert, recurse_key, incpath, **kw), self.conflict) Xinfo() warn('Problem loading included file: ' + `incfilename` + '. Ignoring it...') continue warn('File `%s` not found. Included by %s' % (incfilename, fname)) return data