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

branch
eric7
changeset 9209
b99e7fd55fd3
parent 8881
54e42bc2437a
child 9221
bf71ee032bb4
equal deleted inserted replaced
9208:3fc8dfeb6ebe 9209:b99e7fd55fd3
1 # -*- coding: utf-8 -*-
2
3 # Copyright (c) 2020 - 2022 Detlev Offenbach <detlev@die-offenbachs.de>
4 #
5
6
7 """
8 Module implementing message translations for the code style plugin messages
9 (pathlib part).
10 """
11
12 from PyQt6.QtCore import QCoreApplication
13
14 _pathlibMessages = {
15 "P101": QCoreApplication.translate(
16 "PathlibChecker",
17 "os.chmod('foo', 0o444) should be replaced by foo_path.chmod(0o444)"),
18 "P102": QCoreApplication.translate(
19 "PathlibChecker",
20 "os.mkdir('foo') should be replaced by foo_path.mkdir()"),
21 "P103": QCoreApplication.translate(
22 "PathlibChecker",
23 "os.makedirs('foo/bar') should be replaced by "
24 "bar_path.mkdir(parents=True)"),
25 "P104": QCoreApplication.translate(
26 "PathlibChecker",
27 "os.rename('foo', 'bar') should be replaced by "
28 "foo_path.rename(Path('bar'))"),
29 "P105": QCoreApplication.translate(
30 "PathlibChecker",
31 "os.replace('foo', 'bar') should be replaced by "
32 "foo_path.replace(Path('bar'))"),
33 "P106": QCoreApplication.translate(
34 "PathlibChecker",
35 "os.rmdir('foo') should be replaced by foo_path.rmdir()"),
36 "P107": QCoreApplication.translate(
37 "PathlibChecker",
38 "os.remove('foo') should be replaced by foo_path.unlink()"),
39 "P108": QCoreApplication.translate(
40 "PathlibChecker",
41 "os.unlink('foo'') should be replaced by foo_path.unlink()"),
42 "P109": QCoreApplication.translate(
43 "PathlibChecker",
44 "os.getcwd() should be replaced by Path.cwd()"),
45 "P110": QCoreApplication.translate(
46 "PathlibChecker",
47 "os.readlink('foo') should be replaced by foo_path.readlink()"),
48 "P111": QCoreApplication.translate(
49 "PathlibChecker",
50 "os.stat('foo') should be replaced by foo_path.stat() or "
51 "foo_path.owner() or foo_path.group()"),
52 "P112": QCoreApplication.translate(
53 "PathlibChecker",
54 "os.listdir(path='foo') should be replaced by foo_path.iterdir()"),
55 "P113": QCoreApplication.translate(
56 "PathlibChecker",
57 "os.link('bar', 'foo') should be replaced by"
58 " foo_path.hardlink_to('bar')"),
59 "P114": QCoreApplication.translate(
60 "PathlibChecker",
61 "os.symlink('bar', 'foo') should be replaced by"
62 " foo_path.symlink_to('bar')"),
63
64 "P201": QCoreApplication.translate(
65 "PathlibChecker",
66 "os.path.abspath('foo') should be replaced by foo_path.resolve()"),
67 "P202": QCoreApplication.translate(
68 "PathlibChecker",
69 "os.path.exists('foo') should be replaced by foo_path.exists()"),
70 "P203": QCoreApplication.translate(
71 "PathlibChecker",
72 "os.path.expanduser('~/foo') should be replaced by "
73 "foo_path.expanduser()"),
74 "P204": QCoreApplication.translate(
75 "PathlibChecker",
76 "os.path.isdir('foo') should be replaced by foo_path.is_dir()"),
77 "P205": QCoreApplication.translate(
78 "PathlibChecker",
79 "os.path.isfile('foo') should be replaced by foo_path.is_file()"),
80 "P206": QCoreApplication.translate(
81 "PathlibChecker",
82 "os.path.islink('foo') should be replaced by foo_path.is_symlink()"),
83 "P207": QCoreApplication.translate(
84 "PathlibChecker",
85 "os.path.isabs('foo') should be replaced by foo_path.is_absolute()"),
86 "P208": QCoreApplication.translate(
87 "PathlibChecker",
88 "os.path.join('foo', 'bar') should be replaced by "
89 "foo_path / 'bar'"),
90 "P209": QCoreApplication.translate(
91 "PathlibChecker",
92 "os.path.basename('foo/bar') should be replaced by bar_path.name"),
93 "P210": QCoreApplication.translate(
94 "PathlibChecker",
95 "os.path.dirname('foo/bar') should be replaced by bar_path.parent"),
96 "P211": QCoreApplication.translate(
97 "PathlibChecker",
98 "os.path.samefile('foo', 'bar') should be replaced by "
99 "foo_path.samefile(bar_path)"),
100 "P212": QCoreApplication.translate(
101 "PathlibChecker",
102 "os.path.splitext('foo.bar') should be replaced by foo_path.suffix"),
103 "P213": QCoreApplication.translate(
104 "PathlibChecker",
105 "os.path.relpath('/bar/foo', start='bar') should be replaced by "
106 "foo_path.relative_to('/bar')"),
107
108 "P301": QCoreApplication.translate(
109 "PathlibChecker",
110 "open('foo') should be replaced by Path('foo').open()"),
111
112 "P401": QCoreApplication.translate(
113 "PathlibChecker",
114 "py.path.local is in maintenance mode, use pathlib instead"),
115 }

eric ide

mercurial