本文整理匯總了Python中Filter.Filter.process方法的典型用法代碼示例。如果您正苦於以下問題:Python Filter.process方法的具體用法?Python Filter.process怎麽用?Python Filter.process使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Filter.Filter
的用法示例。
在下文中一共展示了Filter.process方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: test_dict
# 需要導入模塊: from Filter import Filter [as 別名]
# 或者: from Filter.Filter import process [as 別名]
def test_dict(self):
event = Event(0)
event.the_dict = dict( [ (x, x**2) for x in range(10) ] )
cfg_ana = cfg.Analyzer(
Filter,
output = 'filtered',
input_objects = 'the_dict',
filter_func = lambda x : x == 9
)
cfg_comp = cfg.Component(
'test',
files = []
)
filter = Filter(cfg_ana, cfg_comp, self.outdir)
filter.process(event)
self.assertDictEqual(event.filtered, {3:9})
示例2: test_list
# 需要導入模塊: from Filter import Filter [as 別名]
# 或者: from Filter.Filter import process [as 別名]
def test_list(self):
event = Event(0)
event.the_list = range(10)
cfg_ana = cfg.Analyzer(
Filter,
output = 'filtered',
input_objects = 'the_list',
filter_func = lambda x : x%2 == 0
)
cfg_comp = cfg.Component(
'test',
files = []
)
filter = Filter(cfg_ana, cfg_comp, self.outdir)
filter.process(event)
self.assertItemsEqual(event.filtered, [0,2,4,6,8])