コード例 #1
0
ファイル: test_spec.py プロジェクト: areinecke/cylc
def get_cfg( cfile=TEST_FILE, verbose=False, template_vars=[], template_vars_file=None ):
    global cfg
    if not cfg:
        cfg = parse( cfile, verbose=verbose,
                template_vars=template_vars,
                template_vars_file=template_vars_file )
        validate( cfg, SPEC )
        cfg = expand( cfg, SPEC )
    return cfg
コード例 #2
0
ファイル: test_spec.py プロジェクト: areinecke/cylc
def get_cfg(cfile=TEST_FILE,
            verbose=False,
            template_vars=[],
            template_vars_file=None):
    global cfg
    if not cfg:
        cfg = parse(cfile,
                    verbose=verbose,
                    template_vars=template_vars,
                    template_vars_file=template_vars_file)
        validate(cfg, SPEC)
        cfg = expand(cfg, SPEC)
    return cfg
コード例 #3
0
ファイル: loadcfg.py プロジェクト: areinecke/cylc
def load_single( FILE, SPEC, descr, upgrader=None, do_expand=False, verbose=True, strict=False ):
    """
    Parse, upgrade, validate, combine, and expand a single parsec config file.
    If FILE fails to parse or validate just fall back on spec defaults.
    """
    cfg = OrderedDict()
    try:
        cfg = parse( FILE )
    except FileNotFoundError, x:
        if strict:
            raise
        # not an error - may be relying on defaults
        pass
コード例 #4
0
ファイル: config.py プロジェクト: raghu330/cylc
 def loadcfg( self, rcfile, title="", strict=False, silent=False ):
     """Parse a config file, upgrade or deprecate items if necessary,
     validate it against the spec, and if this is not the first load,
     combine/override with the existing loaded config."""
     try:
         sparse = parse( rcfile, write_proc=self.write_proc,
             template_vars=self.tvars, template_vars_file=self.tvars_file )
     except Exception, x:
         if strict:
             raise
         if not silent or cylc.flags.verbose:
             # no user.rc file, for instance, is not really an error.
             print >> sys.stderr, x
             print >> sys.stderr, "WARNING: " + title + " parsing failed (continuing)"
コード例 #5
0
ファイル: config.py プロジェクト: dmanubens-zz/cylc
 def loadcfg(self, rcfile, title="", strict=False, silent=False):
     """Parse a config file, upgrade or deprecate items if necessary,
     validate it against the spec, and if this is not the first load,
     combine/override with the existing loaded config."""
     try:
         sparse = parse(rcfile,
                        write_proc=self.write_proc,
                        template_vars=self.tvars,
                        template_vars_file=self.tvars_file)
     except Exception, x:
         if strict:
             raise
         if not silent or cylc.flags.verbose:
             # no global.rc file, for instance, is not really an error.
             print >> sys.stderr, x
             print >> sys.stderr, "WARNING: " + title + " parsing failed (continuing)"
コード例 #6
0
ファイル: loadcfg.py プロジェクト: areinecke/cylc
def load_single(FILE,
                SPEC,
                descr,
                upgrader=None,
                do_expand=False,
                verbose=True,
                strict=False):
    """
    Parse, upgrade, validate, combine, and expand a single parsec config file.
    If FILE fails to parse or validate just fall back on spec defaults.
    """
    cfg = OrderedDict()
    try:
        cfg = parse(FILE)
    except FileNotFoundError, x:
        if strict:
            raise
        # not an error - may be relying on defaults
        pass