Return lines that begin with name. Lines are expected to look like: name: space separated values Args: name: string, parameter name. lines: iterable of string, lines in the file. Returns: List of values in the lines that match.
(name, lines)
| 63 | |
| 64 | |
| 65 | def get_lines(name, lines): |
| 66 | """Return lines that begin with name. |
| 67 | |
| 68 | Lines are expected to look like: |
| 69 | |
| 70 | name: space separated values |
| 71 | |
| 72 | Args: |
| 73 | name: string, parameter name. |
| 74 | lines: iterable of string, lines in the file. |
| 75 | |
| 76 | Returns: |
| 77 | List of values in the lines that match. |
| 78 | """ |
| 79 | retval = [] |
| 80 | matches = itertools.ifilter(lambda x: x.startswith(name + ":"), lines) |
| 81 | for line in matches: |
| 82 | retval.extend(line[len(name) + 1 :].split()) |
| 83 | return retval |
| 84 | |
| 85 | |
| 86 | def wiki_escape(s): |
no outgoing calls
no test coverage detected
searching dependent graphs…