---
source: crates/ruff_linter/src/rules/flake8_use_pathlib/mod.rs
---
import_from.py:9:5: PTH100 `os.path.abspath()` should be replaced by `Path.resolve()`
   |
 7 | q = "bar"
 8 | 
 9 | a = abspath(p)
   |     ^^^^^^^ PTH100
10 | aa = chmod(p)
11 | aaa = mkdir(p)
   |

import_from.py:10:6: PTH101 `os.chmod()` should be replaced by `Path.chmod()`
   |
 9 | a = abspath(p)
10 | aa = chmod(p)
   |      ^^^^^ PTH101
11 | aaa = mkdir(p)
12 | makedirs(p)
   |

import_from.py:11:7: PTH102 `os.mkdir()` should be replaced by `Path.mkdir()`
   |
 9 | a = abspath(p)
10 | aa = chmod(p)
11 | aaa = mkdir(p)
   |       ^^^^^ PTH102
12 | makedirs(p)
13 | rename(p)
   |

import_from.py:12:1: PTH103 `os.makedirs()` should be replaced by `Path.mkdir(parents=True)`
   |
10 | aa = chmod(p)
11 | aaa = mkdir(p)
12 | makedirs(p)
   | ^^^^^^^^ PTH103
13 | rename(p)
14 | replace(p)
   |

import_from.py:13:1: PTH104 `os.rename()` should be replaced by `Path.rename()`
   |
11 | aaa = mkdir(p)
12 | makedirs(p)
13 | rename(p)
   | ^^^^^^ PTH104
14 | replace(p)
15 | rmdir(p)
   |

import_from.py:14:1: PTH105 `os.replace()` should be replaced by `Path.replace()`
   |
12 | makedirs(p)
13 | rename(p)
14 | replace(p)
   | ^^^^^^^ PTH105
15 | rmdir(p)
16 | remove(p)
   |

import_from.py:15:1: PTH106 `os.rmdir()` should be replaced by `Path.rmdir()`
   |
13 | rename(p)
14 | replace(p)
15 | rmdir(p)
   | ^^^^^ PTH106
16 | remove(p)
17 | unlink(p)
   |

import_from.py:16:1: PTH107 `os.remove()` should be replaced by `Path.unlink()`
   |
14 | replace(p)
15 | rmdir(p)
16 | remove(p)
   | ^^^^^^ PTH107
17 | unlink(p)
18 | getcwd(p)
   |

import_from.py:17:1: PTH108 `os.unlink()` should be replaced by `Path.unlink()`
   |
15 | rmdir(p)
16 | remove(p)
17 | unlink(p)
   | ^^^^^^ PTH108
18 | getcwd(p)
19 | b = exists(p)
   |

import_from.py:18:1: PTH109 `os.getcwd()` should be replaced by `Path.cwd()`
   |
16 | remove(p)
17 | unlink(p)
18 | getcwd(p)
   | ^^^^^^ PTH109
19 | b = exists(p)
20 | bb = expanduser(p)
   |

import_from.py:19:5: PTH110 `os.path.exists()` should be replaced by `Path.exists()`
   |
17 | unlink(p)
18 | getcwd(p)
19 | b = exists(p)
   |     ^^^^^^ PTH110
20 | bb = expanduser(p)
21 | bbb = isdir(p)
   |

import_from.py:20:6: PTH111 `os.path.expanduser()` should be replaced by `Path.expanduser()`
   |
18 | getcwd(p)
19 | b = exists(p)
20 | bb = expanduser(p)
   |      ^^^^^^^^^^ PTH111
21 | bbb = isdir(p)
22 | bbbb = isfile(p)
   |

import_from.py:21:7: PTH112 `os.path.isdir()` should be replaced by `Path.is_dir()`
   |
19 | b = exists(p)
20 | bb = expanduser(p)
21 | bbb = isdir(p)
   |       ^^^^^ PTH112
22 | bbbb = isfile(p)
23 | bbbbb = islink(p)
   |

import_from.py:22:8: PTH113 `os.path.isfile()` should be replaced by `Path.is_file()`
   |
20 | bb = expanduser(p)
21 | bbb = isdir(p)
22 | bbbb = isfile(p)
   |        ^^^^^^ PTH113
23 | bbbbb = islink(p)
24 | readlink(p)
   |

import_from.py:23:9: PTH114 `os.path.islink()` should be replaced by `Path.is_symlink()`
   |
21 | bbb = isdir(p)
22 | bbbb = isfile(p)
23 | bbbbb = islink(p)
   |         ^^^^^^ PTH114
24 | readlink(p)
25 | stat(p)
   |

import_from.py:24:1: PTH115 `os.readlink()` should be replaced by `Path.readlink()`
   |
22 | bbbb = isfile(p)
23 | bbbbb = islink(p)
24 | readlink(p)
   | ^^^^^^^^ PTH115
25 | stat(p)
26 | isabs(p)
   |

import_from.py:25:1: PTH116 `os.stat()` should be replaced by `Path.stat()`, `Path.owner()`, or `Path.group()`
   |
23 | bbbbb = islink(p)
24 | readlink(p)
25 | stat(p)
   | ^^^^ PTH116
26 | isabs(p)
27 | join(p, q)
   |

import_from.py:26:1: PTH117 `os.path.isabs()` should be replaced by `Path.is_absolute()`
   |
24 | readlink(p)
25 | stat(p)
26 | isabs(p)
   | ^^^^^ PTH117
27 | join(p, q)
28 | sep.join((p, q))
   |

import_from.py:27:1: PTH118 `os.path.join()` should be replaced by `Path` with `/` operator
   |
25 | stat(p)
26 | isabs(p)
27 | join(p, q)
   | ^^^^ PTH118
28 | sep.join((p, q))
29 | sep.join([p, q])
   |

import_from.py:28:1: PTH118 `os.sep.join()` should be replaced by `Path` with `/` operator
   |
26 | isabs(p)
27 | join(p, q)
28 | sep.join((p, q))
   | ^^^^^^^^ PTH118
29 | sep.join([p, q])
30 | basename(p)
   |

import_from.py:29:1: PTH118 `os.sep.join()` should be replaced by `Path` with `/` operator
   |
27 | join(p, q)
28 | sep.join((p, q))
29 | sep.join([p, q])
   | ^^^^^^^^ PTH118
30 | basename(p)
31 | dirname(p)
   |

import_from.py:30:1: PTH119 `os.path.basename()` should be replaced by `Path.name`
   |
28 | sep.join((p, q))
29 | sep.join([p, q])
30 | basename(p)
   | ^^^^^^^^ PTH119
31 | dirname(p)
32 | samefile(p)
   |

import_from.py:31:1: PTH120 `os.path.dirname()` should be replaced by `Path.parent`
   |
29 | sep.join([p, q])
30 | basename(p)
31 | dirname(p)
   | ^^^^^^^ PTH120
32 | samefile(p)
33 | splitext(p)
   |

import_from.py:32:1: PTH121 `os.path.samefile()` should be replaced by `Path.samefile()`
   |
30 | basename(p)
31 | dirname(p)
32 | samefile(p)
   | ^^^^^^^^ PTH121
33 | splitext(p)
34 | with open(p) as fp:
   |

import_from.py:33:1: PTH122 `os.path.splitext()` should be replaced by `Path.suffix`, `Path.stem`, and `Path.parent`
   |
31 | dirname(p)
32 | samefile(p)
33 | splitext(p)
   | ^^^^^^^^ PTH122
34 | with open(p) as fp:
35 |     fp.read()
   |

import_from.py:34:6: PTH123 `open()` should be replaced by `Path.open()`
   |
32 | samefile(p)
33 | splitext(p)
34 | with open(p) as fp:
   |      ^^^^ PTH123
35 |     fp.read()
36 | open(p).close()
   |

import_from.py:36:1: PTH123 `open()` should be replaced by `Path.open()`
   |
34 | with open(p) as fp:
35 |     fp.read()
36 | open(p).close()
   | ^^^^ PTH123
   |


