|
1 # -*- coding: utf-8 -*- |
|
2 |
|
3 # Copyright (c) 2021 - 2022 Detlev Offenbach <detlev@die-offenbachs.de> |
|
4 # |
|
5 |
|
6 """ |
|
7 Module implementing message translations for the code style plugin messages |
|
8 (import statements part). |
|
9 """ |
|
10 |
|
11 from PyQt6.QtCore import QCoreApplication |
|
12 |
|
13 _importsMessages = { |
|
14 "I101": QCoreApplication.translate( |
|
15 "ImportsChecker", |
|
16 "local import must be at the beginning of the method body"), |
|
17 "I102": QCoreApplication.translate( |
|
18 "ImportsChecker", |
|
19 "packages from external modules should not be imported locally"), |
|
20 "I103": QCoreApplication.translate( |
|
21 "ImportsChecker", |
|
22 "packages from standard modules should not be imported locally"), |
|
23 |
|
24 "I201": QCoreApplication.translate( |
|
25 "ImportsChecker", |
|
26 "Import statements are in the wrong order. " |
|
27 "'{0}' should be before '{1}'"), |
|
28 "I202": QCoreApplication.translate( |
|
29 "ImportsChecker", |
|
30 "Imported names are in the wrong order. " |
|
31 "Should be '{0}'"), |
|
32 "I203": QCoreApplication.translate( |
|
33 "ImportsChecker", |
|
34 "Import statements should be combined. " |
|
35 "'{0}' should be combined with '{1}'"), |
|
36 "I204": QCoreApplication.translate( |
|
37 "ImportsChecker", |
|
38 "The names in __all__ are in the wrong order. " |
|
39 "The order should be '{0}'"), |
|
40 |
|
41 "I901": QCoreApplication.translate( |
|
42 "ImportsChecker", |
|
43 "unnecessary import alias - rewrite as '{0}'"), |
|
44 "I902": QCoreApplication.translate( |
|
45 "ImportsChecker", |
|
46 "banned import '{0}' used"), |
|
47 "I903": QCoreApplication.translate( |
|
48 "ImportsChecker", |
|
49 "relative imports from parent modules are banned"), |
|
50 "I904": QCoreApplication.translate( |
|
51 "ImportsChecker", |
|
52 "relative imports are banned"), |
|
53 } |
|
54 |
|
55 _importsMessagesSampleArgs = { |
|
56 "I201": ["import bar", "import foo"], |
|
57 "I202": ["bar, baz, foo"], |
|
58 "I203": ["from foo import bar", "from foo import baz"], |
|
59 "I204": ["bar, baz, foo"], |
|
60 "I901": ["from foo import bar"], |
|
61 "I902": ["foo"], |
|
62 } |