当前位置: 首页>>代码示例>>Python>>正文


Python Domain.evoque方法代码示例

本文整理汇总了Python中evoque.domain.Domain.evoque方法的典型用法代码示例。如果您正苦于以下问题:Python Domain.evoque方法的具体用法?Python Domain.evoque怎么用?Python Domain.evoque使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在evoque.domain.Domain的用法示例。


在下文中一共展示了Domain.evoque方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: load

# 需要导入模块: from evoque.domain import Domain [as 别名]
# 或者: from evoque.domain.Domain import evoque [as 别名]
    def load(self,template,vars):
        dp=os.path.dirname(template)
        if dp != '':
            self.domain=dp
            
        filename=os.path.basename(template)

        try:
            d=Domain(self.domain, quoting=None, errors=4) # fixme: what do we really want for quoting?
            t=Domain(self.domain, errors=4).get_template(filename, quoting="str") # fixme: why create two Domains?
        except Exception as e:
            print "(domain is %s)" % self.domain
            raise e

        evars=evoque_dict()             # special dict that returns missing keys as "${key}"
        evars.update(vars)
        yaml_txt=t.evoque(evars)

        # fix eval errors:
        # fixed_yaml=re.sub('\[EvalError\(([a-z_]+)\)]', "${\g<1>}", yaml_txt) # ooh, magic! great.
        # fixed_yaml=re.sub('\[NameError: name &#39; ([a-z_]+)\)]', "${\g<1>}", yaml_txt) # ooh, magic! great.
        # fixed_yaml=re.sub('&lt;built-in function ([a-z_]+)&gt;', "${\g<1>}", fixed_yaml) # christ, more magic

#        warn("syml.load: fixed_yaml is %s" % fixed_yaml)
        d=yaml.load(yaml_txt)
            
        # "fix" config; ie, resolve referenced values
        d=self._fix_hash(d,d)
        return d
开发者ID:iandriver,项目名称:Rnaseq,代码行数:31,代码来源:superyaml.py

示例2: load

# 需要导入模块: from evoque.domain import Domain [as 别名]
# 或者: from evoque.domain.Domain import evoque [as 别名]
    def load(self):
        # get globals if necessary
        if (self.globals == {}) and self.globals_file:
            f = open(self.globals_file, "r")
            self.globals = yaml.load(f)
            f.close

        # read config template (with globals)
        if not self.config_file:
            raise Exception("no config_file")

        if not self.domain:
            try:
                self.domain = self.globals["domain"]
            except:
                self.domain = os.getcwd()
                print "warning: looking for globals.yml in local directory!"

        try:
            t = Domain(self.domain).get_template(self.config_file)
        except Exception as e:
            print "(domain is %s)" % self.domain
            raise e

        conf_yaml = t.evoque(self.globals)
        conf = yaml.load(conf_yaml)

        # "fix" config; ie, resolve referenced values
        conf = self._fix_hash(conf, conf)
        conf.update({"globals": self.globals})

        self.config = conf
开发者ID:phonybone,项目名称:rna-seq-scripts,代码行数:34,代码来源:__init__.py

示例3: as_python

# 需要导入模块: from evoque.domain import Domain [as 别名]
# 或者: from evoque.domain.Domain import evoque [as 别名]
    def as_python(self):
        template_filename=self.rnaseq.globals['step_template']

        try: domain=self.rnaseq.globals['domain']
        except: domain=os.getcwd()
        t=Domain(domain).get_template(template_filename)

        # step.template needs: name, input, output, pipeline_var_name
        # fixme: we killed input_str(), etc, (not cmd_str(), tho)
        vars={'input':self.flatten_attr('inputs'),
              'output':self.flatten_attr('outputs'),
              'name':self.name,
              'pipeline_var_name':self.pipeline_var_name,
            }
        
        template=t.evoque(vars)
        return template
开发者ID:icefoxx,项目名称:rna-seq-scripts,代码行数:19,代码来源:__init__.py


注:本文中的evoque.domain.Domain.evoque方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。