Summary
dir_fd can be used to operate on a file relative to a pinned directory descriptor. This is useful to prevent bugs, most importantly race conditions. The respective functionality is not available in pathlib and the suggestion to use the respective Path methods therefore does not make sense
$ ruff check --select=PTH test.py
test.py:1:1: PTH123 `open()` should be replaced by `Path.open()`
|
1 | open("test.txt", dir_fd=1)
| ^^^^ PTH123
|
Found 1 error.
Version
ruff 0.11.5