(filepath)
| 226 | |
| 227 | |
| 228 | def _read_file(filepath): |
| 229 | # type: (str) -> Optional[str] |
| 230 | try: |
| 231 | with open(filepath) as f: |
| 232 | return f.read() |
| 233 | # This is IOError on Python 2.7 |
| 234 | except (OSError, IOError): # noqa: B014 |
| 235 | log.debug("Could not find file: '%s'", filepath) |
| 236 | return None |
| 237 | |
| 238 | |
| 239 | def _search(regex, text, group_index=0, flags=0): |