Regarding the anti-pattern of [not using with to open files](https://docs.quantifiedcode.com/python-anti-patterns/maintainability/not_using_with_to_open_files.html), if you are reading the entire contents of the file in one shot as in the examples, you can use [`read_text`](https://docs.python.org/3/library/pathlib.html#pathlib.Path.read_text) from `pathlib` which opens and closes the file for you internally. So it isn't always an anti-pattern to not use a context manager for reading text/bytes, in fact I would argue that ```python with open("file.txt", "r") as f: content = f.read() ``` is an anti-pattern for ```python content = Path("file.txt").read_text() ```