本文整理汇总了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])