Debian Codegraph @

test/rsrc/convert_stub.py

raw
1 #!/usr/bin/env python3
2
3 """A tiny tool used to test the `convert` plugin. It copies a file and appends
4 a specified text tag.
5 """
6
7 import sys
8 from pathlib import Path
9
10
11 def convert(in_file: str, out_file: str, tag: str) -> None:
12 """Copy `in_file` to `out_file` and append the string `tag`."""
13 with Path(out_file).open("wb") as out_f, Path(in_file).open("rb") as in_f:
14 out_f.write(in_f.read())
15 out_f.write(tag.encode())
16
17
18 if __name__ == "__main__":
19 convert(sys.argv[1], sys.argv[2], sys.argv[3])