本文整理汇总了Python中Preprocessor.Preprocessor.do_filter方法的典型用法代码示例。如果您正苦于以下问题:Python Preprocessor.do_filter方法的具体用法?Python Preprocessor.do_filter怎么用?Python Preprocessor.do_filter使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Preprocessor.Preprocessor
的用法示例。
在下文中一共展示了Preprocessor.do_filter方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: preprocess
# 需要导入模块: from Preprocessor import Preprocessor [as 别名]
# 或者: from Preprocessor.Preprocessor import do_filter [as 别名]
def preprocess(input, parser, defines={}):
'''
Preprocess the file-like input with the given defines, and send the
preprocessed output line by line to the given parser.
'''
pp = Preprocessor()
pp.context.update(defines)
pp.do_filter('substitution')
pp.out = PreprocessorOutputWrapper(pp, parser)
pp.do_include(input)
示例2: make_preprocessor
# 需要导入模块: from Preprocessor import Preprocessor [as 别名]
# 或者: from Preprocessor.Preprocessor import do_filter [as 别名]
def make_preprocessor(config_status):
pp = Preprocessor()
pp.setLineEndings("lf")
pp.setMarker("#")
pp.do_filter("substitution")
# Might need 'substs' too.
defines = {}
for k, v in config_status['defines']:
if v:
defines[k] = v
pp.context.update(defines)
return pp
示例3: _get_preprocessor
# 需要导入模块: from Preprocessor import Preprocessor [as 别名]
# 或者: from Preprocessor.Preprocessor import do_filter [as 别名]
def _get_preprocessor(self, path, extra):
'''Returns a preprocessor for use by create_config_file and
create_makefile.
'''
pp = Preprocessor()
pp.context.update(self.substs)
pp.context.update(top_srcdir = self.get_top_srcdir(path))
pp.context.update(srcdir = self.get_file_srcdir(path))
pp.context.update(relativesrcdir = self.get_relative_srcdir(path))
pp.context.update(DEPTH = self.get_depth(path))
if extra:
pp.context.update(extra)
pp.do_filter('attemptSubstitution')
pp.setMarker(None)
pp.out = FileAvoidWrite(path)
return pp