本文整理汇总了Python中mrjob.conf.combine_cmds函数的典型用法代码示例。如果您正苦于以下问题:Python combine_cmds函数的具体用法?Python combine_cmds怎么用?Python combine_cmds使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了combine_cmds函数的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _fix_opt
def _fix_opt(self, opt_key, opt_value, source):
"""Check sh_bin"""
opt_value = super(MRJobBinRunner, self)._fix_opt(
opt_key, opt_value, source)
# check that sh_bin doesn't have too many args
if opt_key == 'sh_bin':
# opt_value is usually a string, combiner makes it a list of args
sh_bin = combine_cmds(opt_value)
# empty sh_bin just means to use the default, see #1926
# make these hard requirements in v0.7.0?
if len(sh_bin) > 1 and not os.path.isabs(sh_bin[0]):
log.warning('sh_bin (from %s) should use an absolute path'
' if you want it to take arguments' % source)
elif len(sh_bin) > 2:
log.warning('sh_bin (from %s) should not take more than one'
' argument' % source)
return opt_value
示例2: test_convert_to_list
def test_convert_to_list(self):
assert_equal(combine_cmds('sort', ('grep', '-E')), ['grep', '-E'])
示例3: test_parse_empty_string
def test_parse_empty_string(self):
assert_equal(combine_cmds(''), [])
示例4: test_parse_string
def test_parse_string(self):
assert_equal(combine_cmds('sort', 'grep', 'cat'), ['cat'])
assert_equal(combine_cmds(['python'], 'python -S'), ['python', '-S'])
示例5: test_all_None
def test_all_None(self):
assert_equal(combine_cmds(None, None, None), None)
示例6: test_picks_last_value
def test_picks_last_value(self):
assert_equal(combine_cmds(['sort'], ['grep'], ['cat']), ['cat'])
示例7: test_empty
def test_empty(self):
assert_equal(combine_cmds(), None)
示例8: test_all_None
def test_all_None(self):
self.assertEqual(combine_cmds(None, None, None), None)
示例9: test_empty
def test_empty(self):
self.assertEqual(combine_cmds(), None)
示例10: test_unicode
def test_unicode(self):
self.assertEqual(combine_cmds(u"wunderbar!"), ["wunderbar!"])
示例11: test_convert_to_list
def test_convert_to_list(self):
self.assertEqual(combine_cmds("sort", ("grep", "-E")), ["grep", "-E"])
示例12: test_parse_empty_string
def test_parse_empty_string(self):
self.assertEqual(combine_cmds(""), [])
示例13: test_parse_string
def test_parse_string(self):
self.assertEqual(combine_cmds("sort", "grep", "cat"), ["cat"])
self.assertEqual(combine_cmds(["python"], "python -S"), ["python", "-S"])
示例14: test_picks_last_value
def test_picks_last_value(self):
self.assertEqual(combine_cmds(["sort"], ["grep"], ["cat"]), ["cat"])