MCPcopy Index your code
hub / github.com/dabeaz/python-cookbook / gen_grep

Function gen_grep

src/4/creating_data_processing_pipelines/example.py:37–44  ·  view source on GitHub ↗

Look for a regex pattern in a sequence of lines

(pattern, lines)

Source from the content-addressed store, hash-verified

35 yield from it
36
37def gen_grep(pattern, lines):
38 '''
39 Look for a regex pattern in a sequence of lines
40 '''
41 pat = re.compile(pattern)
42 for line in lines:
43 if pat.search(line):
44 yield line
45
46if __name__ == '__main__':
47

Callers 1

example.pyFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected