---
source: crates/ruff_linter/src/rules/flake8_use_pathlib/mod.rs
---
PTH211 `os.symlink` should be replaced by `Path.symlink_to`
 --> PTH211.py:5:1
  |
5 | os.symlink("usr/bin/python", "tmp/python")
  | ^^^^^^^^^^
6 | os.symlink(b"usr/bin/python", b"tmp/python")
7 | Path("tmp/python").symlink_to("usr/bin/python")  # Ok
  |
help: Replace with `Path(...).symlink_to(...)`

PTH211 `os.symlink` should be replaced by `Path.symlink_to`
 --> PTH211.py:6:1
  |
5 | os.symlink("usr/bin/python", "tmp/python")
6 | os.symlink(b"usr/bin/python", b"tmp/python")
  | ^^^^^^^^^^
7 | Path("tmp/python").symlink_to("usr/bin/python")  # Ok
  |
help: Replace with `Path(...).symlink_to(...)`

PTH211 `os.symlink` should be replaced by `Path.symlink_to`
  --> PTH211.py:9:1
   |
 7 | Path("tmp/python").symlink_to("usr/bin/python")  # Ok
 8 |
 9 | os.symlink("usr/bin/python", "tmp/python", target_is_directory=True)
   | ^^^^^^^^^^
10 | os.symlink(b"usr/bin/python", b"tmp/python", target_is_directory=True)
11 | Path("tmp/python").symlink_to("usr/bin/python", target_is_directory=True)  # Ok
   |
help: Replace with `Path(...).symlink_to(...)`

PTH211 `os.symlink` should be replaced by `Path.symlink_to`
  --> PTH211.py:10:1
   |
 9 | os.symlink("usr/bin/python", "tmp/python", target_is_directory=True)
10 | os.symlink(b"usr/bin/python", b"tmp/python", target_is_directory=True)
   | ^^^^^^^^^^
11 | Path("tmp/python").symlink_to("usr/bin/python", target_is_directory=True)  # Ok
   |
help: Replace with `Path(...).symlink_to(...)`

PTH211 `os.symlink` should be replaced by `Path.symlink_to`
  --> PTH211.py:17:1
   |
15 | os.close(fd)
16 |
17 | os.symlink(src="usr/bin/python", dst="tmp/python", unknown=True)
   | ^^^^^^^^^^
18 | os.symlink("usr/bin/python",  dst="tmp/python", target_is_directory=False)
   |
help: Replace with `Path(...).symlink_to(...)`

PTH211 `os.symlink` should be replaced by `Path.symlink_to`
  --> PTH211.py:18:1
   |
17 | os.symlink(src="usr/bin/python", dst="tmp/python", unknown=True)
18 | os.symlink("usr/bin/python",  dst="tmp/python", target_is_directory=False)
   | ^^^^^^^^^^
19 |
20 | os.symlink(src="usr/bin/python", dst="tmp/python", dir_fd=None)
   |
help: Replace with `Path(...).symlink_to(...)`

PTH211 `os.symlink` should be replaced by `Path.symlink_to`
  --> PTH211.py:20:1
   |
18 | os.symlink("usr/bin/python",  dst="tmp/python", target_is_directory=False)
19 |
20 | os.symlink(src="usr/bin/python", dst="tmp/python", dir_fd=None)
   | ^^^^^^^^^^
21 |
22 | os.symlink("usr/bin/python",  dst="tmp/python", target_is_directory=     True    )
   |
help: Replace with `Path(...).symlink_to(...)`

PTH211 `os.symlink` should be replaced by `Path.symlink_to`
  --> PTH211.py:22:1
   |
20 | os.symlink(src="usr/bin/python", dst="tmp/python", dir_fd=None)
21 |
22 | os.symlink("usr/bin/python",  dst="tmp/python", target_is_directory=     True    )
   | ^^^^^^^^^^
23 | os.symlink("usr/bin/python",  dst="tmp/python", target_is_directory="nonboolean")
   |
help: Replace with `Path(...).symlink_to(...)`

PTH211 `os.symlink` should be replaced by `Path.symlink_to`
  --> PTH211.py:23:1
   |
22 | os.symlink("usr/bin/python",  dst="tmp/python", target_is_directory=     True    )
23 | os.symlink("usr/bin/python",  dst="tmp/python", target_is_directory="nonboolean")
   | ^^^^^^^^^^
   |
help: Replace with `Path(...).symlink_to(...)`
