(file: str, text: str)
| 131 | |
| 132 | |
| 133 | def _write_autogen(file: str, text: str) -> None: |
| 134 | with open(f"./src/pointers/{file}") as f: |
| 135 | lines = f.read().split("\n") # readlines was keeping the \n |
| 136 | |
| 137 | with open(f"./src/pointers/{file}", "w") as f: |
| 138 | try: |
| 139 | index = lines.index("# autogenerated") |
| 140 | except ValueError: |
| 141 | index = lines.index( |
| 142 | "# autogenerated " |
| 143 | ) # in case there's trailing whitespace |
| 144 | |
| 145 | f.write( |
| 146 | "\n".join(lines[: index + 1]) + f"\n{text}", |
| 147 | ) |
| 148 | |
| 149 | |
| 150 | def _get_type(ctype: str, *, add_pointer: bool = False) -> str | None: |
no test coverage detected