本文整理匯總了Python中ranger.core.loader.Loader.work方法的典型用法代碼示例。如果您正苦於以下問題:Python Loader.work方法的具體用法?Python Loader.work怎麽用?Python Loader.work使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類ranger.core.loader.Loader
的用法示例。
在下文中一共展示了Loader.work方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: test_loader
# 需要導入模塊: from ranger.core.loader import Loader [as 別名]
# 或者: from ranger.core.loader.Loader import work [as 別名]
def test_loader(self):
loader = Loader()
fm = OpenStruct(loader=loader)
SettingsAware.settings = Fake()
FileManagerAware.fm = fm
# initially, the loader has nothing to do
self.assertFalse(loader.has_work())
dir = Directory(TESTDIR)
self.assertEqual(None, dir.files)
self.assertFalse(loader.has_work())
# Calling load_content() will enqueue the loading operation.
# dir is not loaded yet, but the loader has work
dir.load_content(schedule=True)
self.assertEqual(None, dir.files)
self.assertTrue(loader.has_work())
iterations = 0
while loader.has_work():
iterations += 1
loader.work()
#print(iterations)
self.assertNotEqual(None, dir.files)
self.assertFalse(loader.has_work())
示例2: benchmark_load
# 需要導入模塊: from ranger.core.loader import Loader [as 別名]
# 或者: from ranger.core.loader.Loader import work [as 別名]
class benchmark_load(object):
def __init__(self):
self.loader = Loader()
fm = OpenStruct(loader=self.loader)
SettingsAware.settings = Fake()
FileManagerAware.fm = fm
self.dir = Directory(TESTDIR)
def bm_run(self, n):
for _ in range(n):
self.dir.load_content(schedule=True)
while self.loader.has_work():
self.loader.work()