コード例 #1
0
ファイル: parameter.py プロジェクト: GlobalFishingWatch/luigi
    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)
コード例 #2
0
ファイル: parameter.py プロジェクト: ryantuck/luigi
    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)
コード例 #3
0
ファイル: parameter.py プロジェクト: spotify/luigi
    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)
コード例 #4
0
    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)
コード例 #5
0
ファイル: parameter.py プロジェクト: konciergeMD/luigi
    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_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)
コード例 #6
0
ファイル: parameter.py プロジェクト: nirmeshk/luigi
    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)