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

branch
eric7
changeset 11147
dee6e106b4d3
parent 11090
f5f5f5803935
child 11150
73d80859079c
equal deleted inserted replaced
11146:59e04f7003e9 11147:dee6e106b4d3
10 """ 10 """
11 11
12 from PyQt6.QtCore import QCoreApplication 12 from PyQt6.QtCore import QCoreApplication
13 13
14 _pathlibMessages = { 14 _pathlibMessages = {
15 "P101": QCoreApplication.translate( 15 "P-101": 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 ),
19 "P102": QCoreApplication.translate( 19 "P-102": QCoreApplication.translate(
20 "PathlibChecker", "os.mkdir('foo') should be replaced by foo_path.mkdir()" 20 "PathlibChecker", "os.mkdir('foo') should be replaced by foo_path.mkdir()"
21 ), 21 ),
22 "P103": QCoreApplication.translate( 22 "P-103": QCoreApplication.translate(
23 "PathlibChecker", 23 "PathlibChecker",
24 "os.makedirs('foo/bar') should be replaced by bar_path.mkdir(parents=True)", 24 "os.makedirs('foo/bar') should be replaced by bar_path.mkdir(parents=True)",
25 ), 25 ),
26 "P104": QCoreApplication.translate( 26 "P-104": QCoreApplication.translate(
27 "PathlibChecker", 27 "PathlibChecker",
28 "os.rename('foo', 'bar') should be replaced by foo_path.rename(Path('bar'))", 28 "os.rename('foo', 'bar') should be replaced by foo_path.rename(Path('bar'))",
29 ), 29 ),
30 "P105": QCoreApplication.translate( 30 "P-105": QCoreApplication.translate(
31 "PathlibChecker", 31 "PathlibChecker",
32 "os.replace('foo', 'bar') should be replaced by " 32 "os.replace('foo', 'bar') should be replaced by "
33 "foo_path.replace(Path('bar'))", 33 "foo_path.replace(Path('bar'))",
34 ), 34 ),
35 "P106": QCoreApplication.translate( 35 "P-106": QCoreApplication.translate(
36 "PathlibChecker", "os.rmdir('foo') should be replaced by foo_path.rmdir()" 36 "PathlibChecker", "os.rmdir('foo') should be replaced by foo_path.rmdir()"
37 ), 37 ),
38 "P107": QCoreApplication.translate( 38 "P-107": QCoreApplication.translate(
39 "PathlibChecker", "os.remove('foo') should be replaced by foo_path.unlink()" 39 "PathlibChecker", "os.remove('foo') should be replaced by foo_path.unlink()"
40 ), 40 ),
41 "P108": QCoreApplication.translate( 41 "P-108": QCoreApplication.translate(
42 "PathlibChecker", "os.unlink('foo'') should be replaced by foo_path.unlink()" 42 "PathlibChecker", "os.unlink('foo'') should be replaced by foo_path.unlink()"
43 ), 43 ),
44 "P109": QCoreApplication.translate( 44 "P-109": QCoreApplication.translate(
45 "PathlibChecker", "os.getcwd() should be replaced by Path.cwd()" 45 "PathlibChecker", "os.getcwd() should be replaced by Path.cwd()"
46 ), 46 ),
47 "P110": QCoreApplication.translate( 47 "P-110": QCoreApplication.translate(
48 "PathlibChecker", "os.readlink('foo') should be replaced by foo_path.readlink()" 48 "PathlibChecker", "os.readlink('foo') should be replaced by foo_path.readlink()"
49 ), 49 ),
50 "P111": QCoreApplication.translate( 50 "P-111": QCoreApplication.translate(
51 "PathlibChecker", 51 "PathlibChecker",
52 "os.stat('foo') should be replaced by foo_path.stat() or " 52 "os.stat('foo') should be replaced by foo_path.stat() or "
53 "foo_path.owner() or foo_path.group()", 53 "foo_path.owner() or foo_path.group()",
54 ), 54 ),
55 "P112": QCoreApplication.translate( 55 "P-112": QCoreApplication.translate(
56 "PathlibChecker", 56 "PathlibChecker",
57 "os.listdir(path='foo') should be replaced by foo_path.iterdir()", 57 "os.listdir(path='foo') should be replaced by foo_path.iterdir()",
58 ), 58 ),
59 "P113": QCoreApplication.translate( 59 "P-113": QCoreApplication.translate(
60 "PathlibChecker", 60 "PathlibChecker",
61 "os.link('bar', 'foo') should be replaced by foo_path.hardlink_to('bar')", 61 "os.link('bar', 'foo') should be replaced by foo_path.hardlink_to('bar')",
62 ), 62 ),
63 "P114": QCoreApplication.translate( 63 "P-114": QCoreApplication.translate(
64 "PathlibChecker", 64 "PathlibChecker",
65 "os.symlink('bar', 'foo') should be replaced by foo_path.symlink_to('bar')", 65 "os.symlink('bar', 'foo') should be replaced by foo_path.symlink_to('bar')",
66 ), 66 ),
67 "P201": QCoreApplication.translate( 67 "P-201": QCoreApplication.translate(
68 "PathlibChecker", 68 "PathlibChecker",
69 "os.path.abspath('foo') should be replaced by foo_path.resolve()", 69 "os.path.abspath('foo') should be replaced by foo_path.resolve()",
70 ), 70 ),
71 "P202": QCoreApplication.translate( 71 "P-202": QCoreApplication.translate(
72 "PathlibChecker", 72 "PathlibChecker",
73 "os.path.exists('foo') should be replaced by foo_path.exists()", 73 "os.path.exists('foo') should be replaced by foo_path.exists()",
74 ), 74 ),
75 "P203": QCoreApplication.translate( 75 "P-203": QCoreApplication.translate(
76 "PathlibChecker", 76 "PathlibChecker",
77 "os.path.expanduser('~/foo') should be replaced by foo_path.expanduser()", 77 "os.path.expanduser('~/foo') should be replaced by foo_path.expanduser()",
78 ), 78 ),
79 "P204": QCoreApplication.translate( 79 "P-204": QCoreApplication.translate(
80 "PathlibChecker", "os.path.isdir('foo') should be replaced by foo_path.is_dir()" 80 "PathlibChecker", "os.path.isdir('foo') should be replaced by foo_path.is_dir()"
81 ), 81 ),
82 "P205": QCoreApplication.translate( 82 "P-205": QCoreApplication.translate(
83 "PathlibChecker", 83 "PathlibChecker",
84 "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 ), 85 ),
86 "P206": QCoreApplication.translate( 86 "P-206": QCoreApplication.translate(
87 "PathlibChecker", 87 "PathlibChecker",
88 "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 ), 89 ),
90 "P207": QCoreApplication.translate( 90 "P-207": QCoreApplication.translate(
91 "PathlibChecker", 91 "PathlibChecker",
92 "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 ), 93 ),
94 "P208": QCoreApplication.translate( 94 "P-208": QCoreApplication.translate(
95 "PathlibChecker", 95 "PathlibChecker",
96 "os.path.join('foo', 'bar') should be replaced by foo_path / 'bar'", 96 "os.path.join('foo', 'bar') should be replaced by foo_path / 'bar'",
97 ), 97 ),
98 "P209": QCoreApplication.translate( 98 "P-209": QCoreApplication.translate(
99 "PathlibChecker", 99 "PathlibChecker",
100 "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 ), 101 ),
102 "P210": QCoreApplication.translate( 102 "P-210": QCoreApplication.translate(
103 "PathlibChecker", 103 "PathlibChecker",
104 "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 ), 105 ),
106 "P211": QCoreApplication.translate( 106 "P-211": QCoreApplication.translate(
107 "PathlibChecker", 107 "PathlibChecker",
108 "os.path.samefile('foo', 'bar') should be replaced by " 108 "os.path.samefile('foo', 'bar') should be replaced by "
109 "foo_path.samefile(bar_path)", 109 "foo_path.samefile(bar_path)",
110 ), 110 ),
111 "P212": QCoreApplication.translate( 111 "P-212": QCoreApplication.translate(
112 "PathlibChecker", 112 "PathlibChecker",
113 "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 ), 114 ),
115 "P213": QCoreApplication.translate( 115 "P-213": QCoreApplication.translate(
116 "PathlibChecker", 116 "PathlibChecker",
117 "os.path.relpath('/bar/foo', start='bar') should be replaced by " 117 "os.path.relpath('/bar/foo', start='bar') should be replaced by "
118 "foo_path.relative_to('/bar')", 118 "foo_path.relative_to('/bar')",
119 ), 119 ),
120 "P301": QCoreApplication.translate( 120 "P-301": QCoreApplication.translate(
121 "PathlibChecker", "open('foo') should be replaced by Path('foo').open()" 121 "PathlibChecker", "open('foo') should be replaced by Path('foo').open()"
122 ), 122 ),
123 "P401": QCoreApplication.translate( 123 "P-401": QCoreApplication.translate(
124 "PathlibChecker", "py.path.local is in maintenance mode, use pathlib instead" 124 "PathlibChecker", "py.path.local is in maintenance mode, use pathlib instead"
125 ), 125 ),
126 } 126 }

eric ide

mercurial