(path, content)
| 44 | |
| 45 | |
| 46 | def write(path, content): |
| 47 | RE_PYTHON_ADDR = re.compile(r"<.+? object at 0x[0-9a-fA-F]+>") |
| 48 | directory = os.path.dirname(path) |
| 49 | if not os.path.exists(directory): |
| 50 | os.makedirs(directory, exist_ok=True) |
| 51 | open(path, "wb").write(content.encode("utf-8")) |
| 52 | |
| 53 | python_addr = RE_PYTHON_ADDR.search(content) |
| 54 | if python_addr: |
| 55 | abort('Found "{}" in {} ({})'.format( |
| 56 | python_addr.group(0), os.path.basename(path), path)) |
| 57 | |
| 58 | |
| 59 | def abort(message): |