Exemple #1
0
def vformat_list(formatter, format_strings, args, kwargs):
    """Format a list of *format_srings* using *formatter*.

    Resulting non-empty strings are joined by a space.
    """
    return " ".join(filter(None,
                           (formatter.vformat(format_string, args, kwargs)
                            for format_string in as_list(format_strings))))
Exemple #2
0
 def _init_implicit_inputs(self, implicit_inputs):
     implicit_inputs = as_list(implicit_inputs)
     try:
         val = getattr(type(self), "executable")
     except AttributeError:
         pass
     else:
         if os.path.isabs(str(val)):
             implicit_inputs.append(val)
     implicit_inputs.extend(self.extra_implicit_inputs())
     self._implicit_inputs = tuple(implicit_inputs)
Exemple #3
0
 def test_set(self):
     self.assertCountEqual(as_list(set(("foo", "bar"))), ["foo", "bar"])
Exemple #4
0
 def test_tuple(self):
     self.assertEqual(as_list(("foo", "bar")), ["foo", "bar"])
Exemple #5
0
 def test_list(self):
     self.assertEqual(as_list(["foo", "bar"]), ["foo", "bar"])
Exemple #6
0
 def test_singleton(self):
     self.assertEqual(as_list("foo"), ["foo"])
Exemple #7
0
 def test_none(self):
     self.assertEqual(as_list(None), [])
Exemple #8
0
 def _init_orderonly_inputs(self, orderonly_inputs):
     orderonly_inputs = as_list(orderonly_inputs)
     orderonly_inputs.extend(self.extra_orderonly_inputs())
     self._orderonly_inputs = tuple(orderonly_inputs)
Exemple #9
0
 def _init_implicit_outputs(self, implicit_outputs):
     implicit_outputs = as_list(implicit_outputs)
     implicit_outputs.extend(self.extra_implicit_outputs())
     self._implicit_outputs = tuple(implicit_outputs)