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


Python shellutils.ProgressBar类代码示例

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


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

示例1: test_refresh_l_size

 def test_refresh_l_size(self):
     pgb_stream = StringIO()
     expected_stream = StringIO()
     pgb = ProgressBar(20, 3, stream=pgb_stream)
     pgb.refresh()
     expected_stream.write("\r["+' '*3+"]")
     self.assertEqual(pgb_stream.getvalue(), expected_stream.getvalue())
开发者ID:michellesun,项目名称:hunt-for-ciabatta,代码行数:7,代码来源:unittest_shellutils.py

示例2: test_refresh

 def test_refresh(self):
     pgb_stream = StringIO()
     expected_stream = StringIO()
     pgb = ProgressBar(20, stream=pgb_stream)
     self.assertEqual(pgb_stream.getvalue(), expected_stream.getvalue()) # nothing print before refresh
     pgb.refresh()
     expected_stream.write("\r["+' '*20+"]")
     self.assertEqual(pgb_stream.getvalue(), expected_stream.getvalue())
开发者ID:michellesun,项目名称:hunt-for-ciabatta,代码行数:8,代码来源:unittest_shellutils.py

示例3: test_update_relative

 def test_update_relative(self):
     pgb_stream = StringIO()
     expected_stream = StringIO()
     size=20
     pgb = ProgressBar(100, size, stream=pgb_stream)
     last = 0
     for dots in xrange(5, 105, 5):
         pgb.update(5, exact=False)
         dots /= 5
         expected_stream.write("\r["+('.'*dots)+(' '*(size-dots))+"]")
         self.assertEqual(pgb_stream.getvalue(), expected_stream.getvalue())
开发者ID:michellesun,项目名称:hunt-for-ciabatta,代码行数:11,代码来源:unittest_shellutils.py

示例4: test_update_exact

 def test_update_exact(self):
     pgb_stream = StringIO()
     expected_stream = StringIO()
     size=20
     pgb = ProgressBar(100, size, stream=pgb_stream)
     last = 0
     for dots in range(10, 105, 15):
         pgb.update(dots, exact=True)
         dots //= 5
         expected_stream.write("\r["+('='*dots)+(' '*(size-dots))+"]")
         self.assertEqual(pgb_stream.getvalue(), expected_stream.getvalue())
开发者ID:alfonsodiecko,项目名称:PYTHON_DIST,代码行数:11,代码来源:unittest_shellutils.py

示例5: _update_test

 def _update_test(self, nbops, expected, size = None):
     pgb_stream = StringIO()
     expected_stream = StringIO()
     if size is None:
         pgb = ProgressBar(nbops, stream=pgb_stream)
         size=20
     else:
         pgb = ProgressBar(nbops, size, stream=pgb_stream)
     last = 0
     for round in expected:
         if not hasattr(round, '__int__'):
             dots, update = round
         else:
             dots, update = round, None
         pgb.update()
         if update or (update is None and dots != last):
             last = dots
             expected_stream.write("\r["+('.'*dots)+(' '*(size-dots))+"]")
         self.assertEqual(pgb_stream.getvalue(), expected_stream.getvalue())
开发者ID:michellesun,项目名称:hunt-for-ciabatta,代码行数:19,代码来源:unittest_shellutils.py


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