当前位置: 首页>>代码示例>>Python>>正文


Python sh.echo函数代码示例

本文整理汇总了Python中sh.echo函数的典型用法代码示例。如果您正苦于以下问题:Python echo函数的具体用法?Python echo怎么用?Python echo使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了echo函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test

def test():
    if not os.path.isfile('a.out'):
        sh.echo('No executable found', _out='results.txt')
        return
    
    result = sh.Command('./a.out')
    result(_out='results.txt')
开发者ID:jonesetc,项目名称:grader-scripts,代码行数:7,代码来源:__init__.py

示例2: test_should_not_pop_stash_on_failure

    def test_should_not_pop_stash_on_failure(self):
        from sh import echo

        git_touch_add_commit('foo', 'bar', 'moo')
        foo_commit, _ = git_log_oneline()[2]

        echo('bar', _out='bar')
        echo('moo', _out='moo')
        git('add', 'bar')

        expected = {
            'bar': 'M ',
            'moo': ' M'
        }
        self.assertEqual(expected, git_status())

        with self.assertRaises(GitRebaseFailed):
            fix(foo_commit)

        status = {
            'bar': 'DU'
        }
        self.assertEqual(status, git_status())

        self.assertEqual(1, git_stash_len())

        actual = git_show('HEAD')['subject']
        expected = git_show(foo_commit)['subject']
        self.assertEqual(expected, actual)
开发者ID:themalkolm,项目名称:git-boots,代码行数:29,代码来源:test_fix.py

示例3: setUp

 def setUp(self, set_pincode_by_id):
     sh.echo("1234, 1234", _out="/run/shm/cellular.tmp")
     try:
         os.unlink(dirpath + "/../data/cellular.json")
     except Exception:
         pass
     set_pincode_by_id.return_value = True
     self.cellular = Cellular(connection=Mockup())
开发者ID:imZack,项目名称:sanji-bundle-cellular,代码行数:8,代码来源:test_cellular.py

示例4: echo_hello_world_cmd

def echo_hello_world_cmd(**kwargs):
    """
    Usage:
        echo hello world --user <user> <target> [--chinese (yes|no)]

    Options:
        --user <user>             Hello World [default: root]
        -c,--chinese              Use Chinese to say hello world
    """
    print echo("echo hello world:" + kwargs["user"])
开发者ID:Swind,项目名称:clif,代码行数:10,代码来源:echo_hello_world.py

示例5: test_should_rollback_on_failure_if_requested

    def test_should_rollback_on_failure_if_requested(self):
        from sh import echo

        git_touch_add_commit('foo', 'bar')
        foo_commit, _ = git_log_oneline()[1]
        echo('bar', _out='bar')
        git('add', 'bar')

        with self.assertRaises(GitRebaseFailed):
            with git_state_invariant():
                fix('--atomic', foo_commit)
开发者ID:themalkolm,项目名称:git-boots,代码行数:11,代码来源:test_fix.py

示例6: convert

 def convert(match):
     source = match.groups()[0]
     source = '\n'.join(l.strip() for l in source.split('\n'))
     source = "<pre>%s</pre>" % source
     rst_source = pandoc(echo(source), f='html', t='rst').stdout.decode('utf8')
     # rst_source = rst_source.strip().replace('\n', '\n   ') + '\n'
     return rst_source
开发者ID:dmascialino,项目名称:waliki,代码行数:7,代码来源:moin_migration_cleanup.py

示例7: test_unicode_arg

    def test_unicode_arg(self):
        from sh import echo
        if IS_PY3: test = "漢字"
        else: test = "漢字".decode("utf8")
        p = echo(test).strip()

        self.assertEqual(test, p)
开发者ID:dschexna,项目名称:fedemo,代码行数:7,代码来源:test.py

示例8: test_search

    def test_search(self):
        """Make sure aspiration search is the same as ordinary search
        Uses random fens as values, so not guaranteed to produce the same
        output when run multiple times"""
        lines = str(sh.rl("test/data/fenio.fens", "--count=10")).rstrip("\n")

        sh.make("aspire_search")
        run = sh.Command("./aspire_search")
        aspire_output = str(run(sh.echo(lines)))

        sh.make("no_aspire_search")
        run = sh.Command("./no_aspire_search")
        no_aspire_output = str(run(sh.echo(lines)))

        for fen_orig, fen1, fen2 in zip(lines.split("\n"), aspire_output.split("\n"), no_aspire_output.split("\n")):
            self.assertEquals(fen1, fen2, "Original fen: '%s'" % fen_orig)
开发者ID:naftaliharris,项目名称:markovian,代码行数:16,代码来源:runtests.py

示例9: avi_seek

def avi_seek(seek):
  fifo = '/tmp/omxplayer_fifo'

  direction = ''
  if seek == 1:
    direction = "$'\x1b\x5b\x42'"
  elif seek == 2:
    direction = "$'\x1b\x5b\x44'"
  elif seek == 3:
    direction = "$'\x1b\x5b\x43'"
  elif seek == 4:
    direction = "$'\x1b\x5b\x41'"
  else:
    direction = "."

  sh.echo('-n', direction, '>', fifo, _bg=True)
开发者ID:mess110,项目名称:servusberry,代码行数:16,代码来源:command_builder.py

示例10: test_stringio_output

    def test_stringio_output(self):
        from sh import echo
        if IS_PY3:
            from io import StringIO
            from io import BytesIO as cStringIO
        else:
            from StringIO import StringIO
            from cStringIO import StringIO as cStringIO

        out = StringIO()
        echo("-n", "testing 123", _out=out)
        self.assertEqual(out.getvalue(), "testing 123")

        out = cStringIO()
        echo("-n", "testing 123", _out=out)
        self.assertEqual(out.getvalue().decode(), "testing 123")
开发者ID:ahhentz,项目名称:sh,代码行数:16,代码来源:test.py

示例11: test_unicode_arg

 def test_unicode_arg(self):
     from sh import echo
     
     test = "漢字"
     if not IS_PY3: test = test.decode("utf8")
     
     p = echo(test).strip()
     self.assertEqual(test, p)
开发者ID:ahhentz,项目名称:sh,代码行数:8,代码来源:test.py

示例12: say

    def say(self, message, voice=None, block=True):
        if not voice:
            voice = self.default_voice

        voice_part = '(voice_{0})'.format(voice)
        text_part = '(SayText "{0}")'.format(common.sterilize(message))
        command = voice_part + text_part
        festival(echo(command), _bg=not block)
开发者ID:Aeva,项目名称:voice,代码行数:8,代码来源:festival.py

示例13: run_jbofihe

def run_jbofihe(args, lojban):
    """ In order to pipe correctly we have to use two commandline wrappers. """
    try:
        return sh.jbofihe(sh.echo(lojban), *args.split())
    except Exception, e:
        print "Got an error: %s" % type(e)
        print "It reads:"
        print e.message
        print "The Exception vanishes in a puff of lojic."
        sys.exit()
开发者ID:isnok,项目名称:pylo,代码行数:10,代码来源:Helpers.py

示例14: say_sync

def say_sync(text):
    to_say = echo(text)
    audio = festival_client(to_say, ttw=True)
    paplay( audio,
            channels=1,
            raw=True,
            format="s16le",
            rate=32000,
            device="teesink",
    )
开发者ID:shunyata,项目名称:web-avatar,代码行数:10,代码来源:festival.py

示例15: test_unicode_arg

    def test_unicode_arg(self):
        from sh import echo

        test = "漢字"
        if not IS_PY3:
            test = test.decode("utf8")

        p = echo(test, _encoding="utf8")
        output = p.strip()
        self.assertEqual(test, output)
开发者ID:0xr0ot,项目名称:sh,代码行数:10,代码来源:test.py


注:本文中的sh.echo函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。