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


Python CmdlineParser.get_instance方法代码示例

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


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

示例1: _value_iterator

# 需要导入模块: from luigi.cmdline_parser import CmdlineParser [as 别名]
# 或者: from luigi.cmdline_parser.CmdlineParser import get_instance [as 别名]
    def _value_iterator(self, task_name, param_name):
        """
        Yield the parameter values, with optional deprecation warning as second tuple value.

        The parameter value will be whatever non-_no_value that is yielded first.
        """
        cp_parser = CmdlineParser.get_instance()
        if cp_parser:
            dest = self._parser_global_dest(param_name, task_name)
            found = getattr(cp_parser.known_args, dest, None)
            yield (self._parse_or_no_value(found), None)
        yield (self._get_value_from_config(task_name, param_name), None)
        yield (
            self._get_value_from_config(task_name, param_name.replace("_", "-")),
            "Configuration [{}] {} (with dashes) should be avoided. Please use underscores.".format(
                task_name, param_name
            ),
        )
        if self.__config:
            yield (
                self._get_value_from_config(self.__config["section"], self.__config["name"]),
                "The use of the configuration [{}] {} is deprecated. Please use [{}] {}".format(
                    self.__config["section"], self.__config["name"], task_name, param_name
                ),
            )
        yield (self._default, None)
开发者ID:ryantuck,项目名称:luigi,代码行数:28,代码来源:parameter.py

示例2: _value_iterator

# 需要导入模块: from luigi.cmdline_parser import CmdlineParser [as 别名]
# 或者: from luigi.cmdline_parser.CmdlineParser import get_instance [as 别名]
    def _value_iterator(self, task_name, param_name):
        """
        Yield the parameter values, with optional deprecation warning as second tuple value.

        The parameter value will be whatever non-_no_value that is yielded first.
        """
        cp_parser = CmdlineParser.get_instance()
        if cp_parser:
            dest = self._parser_global_dest(param_name, task_name)
            found = getattr(cp_parser.known_args, dest, None)
            yield (self._parse_or_no_value(found), None)
        yield (self._get_value_from_config(task_name, param_name), None)
        if self._config_path:
            yield (self._get_value_from_config(self._config_path['section'], self._config_path['name']),
                   'The use of the configuration [{}] {} is deprecated. Please use [{}] {}'.format(
                       self._config_path['section'], self._config_path['name'], task_name, param_name))
        yield (self._default, None)
开发者ID:spotify,项目名称:luigi,代码行数:19,代码来源:parameter.py

示例3: _value_iterator

# 需要导入模块: from luigi.cmdline_parser import CmdlineParser [as 别名]
# 或者: from luigi.cmdline_parser.CmdlineParser import get_instance [as 别名]
    def _value_iterator(self, task_name, param_name):
        """
        Yield the parameter values, with optional deprecation warning as second tuple value.

        The parameter value will be whatever non-_no_value that is yielded first.
        """
        cp_parser = CmdlineParser.get_instance()
        if cp_parser:
            is_without_section = not task_register.Register.get_task_cls(task_name).use_cmdline_section
            globs = [True] + ([False] if cp_parser.is_local_task(task_name) else [])
            for glob in globs:
                dest = self._parser_dest(param_name, task_name, glob=glob, is_without_section=is_without_section)
                if dest:
                    found = getattr(cp_parser.known_args, dest, None)
                    yield (self._parse_or_no_value(found), None)
        yield (self._get_value_from_config(task_name, param_name), None)
        yield (self._get_value_from_config(task_name, param_name.replace('_', '-')),
               'Configuration [{}] {} (with dashes) should be avoided. Please use underscores.'.format(
               task_name, param_name))
        if self.__config:
            yield (self._get_value_from_config(self.__config['section'], self.__config['name']),
                   'The use of the configuration [{}] {} is deprecated. Please use [{}] {}'.format(
                   self.__config['section'], self.__config['name'], task_name, param_name))
        yield (self.__default, None)
开发者ID:nirmeshk,项目名称:luigi,代码行数:26,代码来源:parameter.py


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