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


Python Utils.update方法代码示例

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


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

示例1: _mergeParamsComponent

# 需要导入模块: from utils import Utils [as 别名]
# 或者: from utils.Utils import update [as 别名]
    def _mergeParamsComponent(self, component=GLOBAL_CONF, global_base = True):
        component_config = self._mergeParamsComponent() if not component == GLOBAL_CONF and global_base else {}
        if component==GLOBAL_CONF:
            if self.mainfile_data and PARAMS_KEY in self.mainfile_data:
                component_config = Utils.update(component_config, self.mainfile_data[PARAMS_KEY])
        else:
            graph_item = self.getComponent(component)
            if graph_item and PARAMS_KEY in graph_item:
                config = self.fromListToDict(graph_item[PARAMS_KEY])
                component_config = Utils.update(component_config, config)

        if component in self.answers_data:
            tmp_clean_answers = self._cleanNullValues(self.answers_data[component])
            component_config = Utils.update(component_config, tmp_clean_answers)
        return component_config
开发者ID:veillard,项目名称:atomicapp,代码行数:17,代码来源:nulecule_base.py

示例2: loadAnswers

# 需要导入模块: from utils import Utils [as 别名]
# 或者: from utils.Utils import update [as 别名]
    def loadAnswers(self, data=None):
        if not data:
            logger.info("No answers data given")

        if type(data) == dict:
            logger.debug("Data given %s", data)
        elif os.path.exists(data):
            logger.debug("Path to answers file given, loading %s", data)
            if os.path.isdir(data):
                if os.path.isfile(os.path.join(data, ANSWERS_FILE)):
                    data = os.path.join(data, ANSWERS_FILE)
                else:
                    self.write_sample_answers = True

            if os.path.isfile(data):
                data = anymarkup.parse_file(data)
        else:
            self.write_sample_answers = True

        if self.write_sample_answers:
            data = copy.deepcopy(DEFAULT_ANSWERS)

        if self.answers_data:
            self.answers_data = Utils.update(self.answers_data, data)
        else:
            self.answers_data = data

        return self.answers_data
开发者ID:weaver-viii,项目名称:atomicapp,代码行数:30,代码来源:nulecule_base.py

示例3: _installDependencies

# 需要导入模块: from utils import Utils [as 别名]
# 或者: from utils.Utils import update [as 别名]
    def _installDependencies(self):
        values = {}
        for graph_item in self.nulecule_base.mainfile_data["graph"]:
            component = graph_item.get("name")
            if not component:
                raise ValueError("Component name missing in graph")

            if not self.utils.isExternal(graph_item):
                values[component] = self.nulecule_base.getValues(component, skip_asking = True)
                logger.debug("Component %s is part of the app", component)
                logger.debug("Values: %s", values)
                continue

            logger.info("Component %s is external dependency", component)

            image_name = self.utils.getSourceImage(graph_item)
            component_path = self.utils.getExternalAppDir(component)
            mainfile_component_path = os.path.join(component_path, MAIN_FILE)
            logger.debug("Component path: %s", component_path)
            if not os.path.isfile(mainfile_component_path) or self.nulecule_base.update:
                printStatus("Pulling %s ..." % image_name)
                component_app = Install(self.nulecule_base.answers_data, image_name, self.nulecule_base.nodeps, 
                                        self.nulecule_base.update, component_path, self.dryrun)
                values = Utils.update(values, component_app.install())
                printStatus("Component %s installed successfully."%component)
                logger.debug("Component installed into %s", component_path)
            else:
                printStatus("Component %s already installed."%component)
                logger.info("Component %s already exists at %s - remove the directory or use --update option", component, component_path)

        return values
开发者ID:veillard,项目名称:atomicapp,代码行数:33,代码来源:install.py

示例4: loadParams

# 需要导入模块: from utils import Utils [as 别名]
# 或者: from utils.Utils import update [as 别名]
    def loadParams(self, data=None):
        if type(data) == dict:
            logger.debug("Data given: %s", data)
        elif os.path.exists(data):
            logger.debug("Path given, loading %s", data)
            data = anymarkup.parse_file(data)
        else:
            raise Exception("Given params are broken: %s" % data)

        if "specversion" in data:
            logger.debug("Params part of %s", MAIN_FILE)
            tmp = {}
            tmp[GLOBAL_CONF] = self.fromListToDict(data[PARAMS_KEY])
            data = tmp
        else:
            logger.debug("Params in separate file")

        if self.params_data:
            self.params_data = Utils.update(self.params_data, data)
        else:
            self.params_data = data

        return self.params_data
开发者ID:weaver-viii,项目名称:atomicapp,代码行数:25,代码来源:nulecule_base.py


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