Return an opened output file descriptor for ``outfile``.
(outfile: str)
| 42 | |
| 43 | |
| 44 | def _get_outstream(outfile: str) -> Any: |
| 45 | """ |
| 46 | Return an opened output file descriptor for ``outfile``. |
| 47 | """ |
| 48 | dir_name = osp.dirname(outfile) |
| 49 | failed_file = outfile + "_failed" |
| 50 | if osp.exists(failed_file): |
| 51 | os.remove(failed_file) |
| 52 | try: |
| 53 | os.makedirs(dir_name) |
| 54 | except OSError: |
| 55 | pass |
| 56 | return open(outfile, mode="w", encoding="utf-8") |
| 57 | |
| 58 | |
| 59 | def syntax_check(filename: str) -> bool: |