src/eric7/Plugins/CheckerPlugins/CodeStyleChecker/PathLib/translations.py

branch
eric7
changeset 9221
bf71ee032bb4
parent 9209
b99e7fd55fd3
child 9576
be9f8e7e42e0
equal deleted inserted replaced
9220:e9e7eca7efee 9221:bf71ee032bb4
12 from PyQt6.QtCore import QCoreApplication 12 from PyQt6.QtCore import QCoreApplication
13 13
14 _pathlibMessages = { 14 _pathlibMessages = {
15 "P101": QCoreApplication.translate( 15 "P101": QCoreApplication.translate(
16 "PathlibChecker", 16 "PathlibChecker",
17 "os.chmod('foo', 0o444) should be replaced by foo_path.chmod(0o444)"), 17 "os.chmod('foo', 0o444) should be replaced by foo_path.chmod(0o444)",
18 ),
18 "P102": QCoreApplication.translate( 19 "P102": QCoreApplication.translate(
19 "PathlibChecker", 20 "PathlibChecker", "os.mkdir('foo') should be replaced by foo_path.mkdir()"
20 "os.mkdir('foo') should be replaced by foo_path.mkdir()"), 21 ),
21 "P103": QCoreApplication.translate( 22 "P103": QCoreApplication.translate(
22 "PathlibChecker", 23 "PathlibChecker",
23 "os.makedirs('foo/bar') should be replaced by " 24 "os.makedirs('foo/bar') should be replaced by " "bar_path.mkdir(parents=True)",
24 "bar_path.mkdir(parents=True)"), 25 ),
25 "P104": QCoreApplication.translate( 26 "P104": QCoreApplication.translate(
26 "PathlibChecker", 27 "PathlibChecker",
27 "os.rename('foo', 'bar') should be replaced by " 28 "os.rename('foo', 'bar') should be replaced by " "foo_path.rename(Path('bar'))",
28 "foo_path.rename(Path('bar'))"), 29 ),
29 "P105": QCoreApplication.translate( 30 "P105": QCoreApplication.translate(
30 "PathlibChecker", 31 "PathlibChecker",
31 "os.replace('foo', 'bar') should be replaced by " 32 "os.replace('foo', 'bar') should be replaced by "
32 "foo_path.replace(Path('bar'))"), 33 "foo_path.replace(Path('bar'))",
34 ),
33 "P106": QCoreApplication.translate( 35 "P106": QCoreApplication.translate(
34 "PathlibChecker", 36 "PathlibChecker", "os.rmdir('foo') should be replaced by foo_path.rmdir()"
35 "os.rmdir('foo') should be replaced by foo_path.rmdir()"), 37 ),
36 "P107": QCoreApplication.translate( 38 "P107": QCoreApplication.translate(
37 "PathlibChecker", 39 "PathlibChecker", "os.remove('foo') should be replaced by foo_path.unlink()"
38 "os.remove('foo') should be replaced by foo_path.unlink()"), 40 ),
39 "P108": QCoreApplication.translate( 41 "P108": QCoreApplication.translate(
40 "PathlibChecker", 42 "PathlibChecker", "os.unlink('foo'') should be replaced by foo_path.unlink()"
41 "os.unlink('foo'') should be replaced by foo_path.unlink()"), 43 ),
42 "P109": QCoreApplication.translate( 44 "P109": QCoreApplication.translate(
43 "PathlibChecker", 45 "PathlibChecker", "os.getcwd() should be replaced by Path.cwd()"
44 "os.getcwd() should be replaced by Path.cwd()"), 46 ),
45 "P110": QCoreApplication.translate( 47 "P110": QCoreApplication.translate(
46 "PathlibChecker", 48 "PathlibChecker", "os.readlink('foo') should be replaced by foo_path.readlink()"
47 "os.readlink('foo') should be replaced by foo_path.readlink()"), 49 ),
48 "P111": QCoreApplication.translate( 50 "P111": QCoreApplication.translate(
49 "PathlibChecker", 51 "PathlibChecker",
50 "os.stat('foo') should be replaced by foo_path.stat() or " 52 "os.stat('foo') should be replaced by foo_path.stat() or "
51 "foo_path.owner() or foo_path.group()"), 53 "foo_path.owner() or foo_path.group()",
54 ),
52 "P112": QCoreApplication.translate( 55 "P112": QCoreApplication.translate(
53 "PathlibChecker", 56 "PathlibChecker",
54 "os.listdir(path='foo') should be replaced by foo_path.iterdir()"), 57 "os.listdir(path='foo') should be replaced by foo_path.iterdir()",
58 ),
55 "P113": QCoreApplication.translate( 59 "P113": QCoreApplication.translate(
56 "PathlibChecker", 60 "PathlibChecker",
57 "os.link('bar', 'foo') should be replaced by" 61 "os.link('bar', 'foo') should be replaced by" " foo_path.hardlink_to('bar')",
58 " foo_path.hardlink_to('bar')"), 62 ),
59 "P114": QCoreApplication.translate( 63 "P114": QCoreApplication.translate(
60 "PathlibChecker", 64 "PathlibChecker",
61 "os.symlink('bar', 'foo') should be replaced by" 65 "os.symlink('bar', 'foo') should be replaced by" " foo_path.symlink_to('bar')",
62 " foo_path.symlink_to('bar')"), 66 ),
63
64 "P201": QCoreApplication.translate( 67 "P201": QCoreApplication.translate(
65 "PathlibChecker", 68 "PathlibChecker",
66 "os.path.abspath('foo') should be replaced by foo_path.resolve()"), 69 "os.path.abspath('foo') should be replaced by foo_path.resolve()",
70 ),
67 "P202": QCoreApplication.translate( 71 "P202": QCoreApplication.translate(
68 "PathlibChecker", 72 "PathlibChecker",
69 "os.path.exists('foo') should be replaced by foo_path.exists()"), 73 "os.path.exists('foo') should be replaced by foo_path.exists()",
74 ),
70 "P203": QCoreApplication.translate( 75 "P203": QCoreApplication.translate(
71 "PathlibChecker", 76 "PathlibChecker",
72 "os.path.expanduser('~/foo') should be replaced by " 77 "os.path.expanduser('~/foo') should be replaced by " "foo_path.expanduser()",
73 "foo_path.expanduser()"), 78 ),
74 "P204": QCoreApplication.translate( 79 "P204": QCoreApplication.translate(
75 "PathlibChecker", 80 "PathlibChecker", "os.path.isdir('foo') should be replaced by foo_path.is_dir()"
76 "os.path.isdir('foo') should be replaced by foo_path.is_dir()"), 81 ),
77 "P205": QCoreApplication.translate( 82 "P205": QCoreApplication.translate(
78 "PathlibChecker", 83 "PathlibChecker",
79 "os.path.isfile('foo') should be replaced by foo_path.is_file()"), 84 "os.path.isfile('foo') should be replaced by foo_path.is_file()",
85 ),
80 "P206": QCoreApplication.translate( 86 "P206": QCoreApplication.translate(
81 "PathlibChecker", 87 "PathlibChecker",
82 "os.path.islink('foo') should be replaced by foo_path.is_symlink()"), 88 "os.path.islink('foo') should be replaced by foo_path.is_symlink()",
89 ),
83 "P207": QCoreApplication.translate( 90 "P207": QCoreApplication.translate(
84 "PathlibChecker", 91 "PathlibChecker",
85 "os.path.isabs('foo') should be replaced by foo_path.is_absolute()"), 92 "os.path.isabs('foo') should be replaced by foo_path.is_absolute()",
93 ),
86 "P208": QCoreApplication.translate( 94 "P208": QCoreApplication.translate(
87 "PathlibChecker", 95 "PathlibChecker",
88 "os.path.join('foo', 'bar') should be replaced by " 96 "os.path.join('foo', 'bar') should be replaced by " "foo_path / 'bar'",
89 "foo_path / 'bar'"), 97 ),
90 "P209": QCoreApplication.translate( 98 "P209": QCoreApplication.translate(
91 "PathlibChecker", 99 "PathlibChecker",
92 "os.path.basename('foo/bar') should be replaced by bar_path.name"), 100 "os.path.basename('foo/bar') should be replaced by bar_path.name",
101 ),
93 "P210": QCoreApplication.translate( 102 "P210": QCoreApplication.translate(
94 "PathlibChecker", 103 "PathlibChecker",
95 "os.path.dirname('foo/bar') should be replaced by bar_path.parent"), 104 "os.path.dirname('foo/bar') should be replaced by bar_path.parent",
105 ),
96 "P211": QCoreApplication.translate( 106 "P211": QCoreApplication.translate(
97 "PathlibChecker", 107 "PathlibChecker",
98 "os.path.samefile('foo', 'bar') should be replaced by " 108 "os.path.samefile('foo', 'bar') should be replaced by "
99 "foo_path.samefile(bar_path)"), 109 "foo_path.samefile(bar_path)",
110 ),
100 "P212": QCoreApplication.translate( 111 "P212": QCoreApplication.translate(
101 "PathlibChecker", 112 "PathlibChecker",
102 "os.path.splitext('foo.bar') should be replaced by foo_path.suffix"), 113 "os.path.splitext('foo.bar') should be replaced by foo_path.suffix",
114 ),
103 "P213": QCoreApplication.translate( 115 "P213": QCoreApplication.translate(
104 "PathlibChecker", 116 "PathlibChecker",
105 "os.path.relpath('/bar/foo', start='bar') should be replaced by " 117 "os.path.relpath('/bar/foo', start='bar') should be replaced by "
106 "foo_path.relative_to('/bar')"), 118 "foo_path.relative_to('/bar')",
107 119 ),
108 "P301": QCoreApplication.translate( 120 "P301": QCoreApplication.translate(
109 "PathlibChecker", 121 "PathlibChecker", "open('foo') should be replaced by Path('foo').open()"
110 "open('foo') should be replaced by Path('foo').open()"), 122 ),
111
112 "P401": QCoreApplication.translate( 123 "P401": QCoreApplication.translate(
113 "PathlibChecker", 124 "PathlibChecker", "py.path.local is in maintenance mode, use pathlib instead"
114 "py.path.local is in maintenance mode, use pathlib instead"), 125 ),
115 } 126 }

eric ide

mercurial