本文整理汇总了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)
示例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)
示例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)