Пример #1
0
 def test_parse_and_save_simple(self):
     args = ['x.py', '-b', '-a', '--no-a', '-x', 'x', '-y', 'y', '-x', 'z']
     self.assertEqual(
         dict(parse_and_save_options(self.original_parser, args)), {
             'a': ['-b', '-a', '--no-a'],
             'x': ['-x', 'x', '-x', 'z'],
             'y': ['-y', 'y']
         })
Пример #2
0
 def test_parse_and_save_simple(self):
     args = ['x.py', '-b', '-a', '--no-a', '-x', 'x', '-y', 'y', '-x', 'z']
     self.assertEqual(
         dict(parse_and_save_options(self.original_parser, args)),
         {
             'a': ['-b', '-a', '--no-a'],
             'x': ['-x', 'x', '-x', 'z'],
             'y': ['-y', 'y']
         })
Пример #3
0
 def test_parse_and_save_with_dashes(self):
     args = ['x.py', '-b', '-a', '--no-a', '-x', 'x', '-y', 'y', '-x', 'z',
             '--', 'ignore', 'these', 'args']
     self.assertEqual(
         dict(parse_and_save_options(self.original_parser, args)),
         {
             'a': ['-b', '-a', '--no-a'],
             'x': ['-x', 'x', '-x', 'z'],
             'y': ['-y', 'y']
         })
Пример #4
0
 def test_parse_and_save_with_dashes(self):
     args = ['x.py', '-b', '-a', '--no-a', '-x', 'x', '-y', 'y', '-x', 'z',
             '--', 'ignore', 'these', 'args']
     self.assertEqual(
         dict(parse_and_save_options(self.original_parser, args)),
         {
             'a': ['-b', '-a', '--no-a'],
             'x': ['-x', 'x', '-x', 'z'],
             'y': ['-y', 'y']
         })
Пример #5
0
    def generate_passthrough_arguments(self):
        """Returns a list of arguments to pass to subprocesses, either on
        hadoop or executed via subprocess.

        These are passed to :py:meth:`mrjob.runner.MRJobRunner.__init__`
        as *extra_args*.
        """
        arg_map = parse_and_save_options(self.option_parser, self._cl_args)
        output_args = []

        passthrough_dests = sorted(set(option.dest for option in self._passthrough_options))
        for option_dest in passthrough_dests:
            output_args.extend(arg_map.get(option_dest, []))

        return output_args
Пример #6
0
    def generate_passthrough_arguments(self):
        """Returns a list of arguments to pass to subprocesses, either on
        hadoop or executed via subprocess.

        These are passed to :py:meth:`mrjob.runner.MRJobRunner.__init__`
        as *extra_args*.
        """
        arg_map = parse_and_save_options(self.option_parser, self._cl_args)
        output_args = []

        passthrough_dests = sorted(
            set(option.dest for option in self._passthrough_options))
        for option_dest in passthrough_dests:
            output_args.extend(arg_map.get(option_dest, []))

        return output_args
Пример #7
0
 def test_parse_and_save_with_dashes(self):
     args = ["x.py", "-b", "-a", "--no-a", "-x", "x", "-y", "y", "-x", "z", "--", "ignore", "these", "args"]
     self.assertEqual(
         dict(parse_and_save_options(self.original_parser, args)),
         {"a": ["-b", "-a", "--no-a"], "x": ["-x", "x", "-x", "z"], "y": ["-y", "y"]},
     )
Пример #8
0
 def test_parse_and_save_simple(self):
     args = ["x.py", "-b", "-a", "--no-a", "-x", "x", "-y", "y", "-x", "z"]
     self.assertEqual(
         dict(parse_and_save_options(self.original_parser, args)),
         {"a": ["-b", "-a", "--no-a"], "x": ["-x", "x", "-x", "z"], "y": ["-y", "y"]},
     )