(text, filter_=None)
| 109 | |
| 110 | @staticmethod |
| 111 | def read(text, filter_=None): |
| 112 | lines = filter(filter_, map(str.strip, text.splitlines())) |
| 113 | name = None |
| 114 | for value in lines: |
| 115 | section_match = value.startswith('[') and value.endswith(']') |
| 116 | if section_match: |
| 117 | name = value.strip('[]') |
| 118 | continue |
| 119 | yield Pair(name, value) |
| 120 | |
| 121 | @staticmethod |
| 122 | def valid(line: str): |
no test coverage detected