|
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 (code annotations part). |
|
10 """ |
|
11 |
|
12 from PyQt6.QtCore import QCoreApplication |
|
13 |
|
14 _annotationsMessages = { |
|
15 "A001": QCoreApplication.translate( |
|
16 "AnnotationsChecker", |
|
17 "missing type annotation for function argument '{0}'"), |
|
18 "A002": QCoreApplication.translate( |
|
19 "AnnotationsChecker", |
|
20 "missing type annotation for '*{0}'"), |
|
21 "A003": QCoreApplication.translate( |
|
22 "AnnotationsChecker", |
|
23 "missing type annotation for '**{0}'"), |
|
24 "A101": QCoreApplication.translate( |
|
25 "AnnotationsChecker", |
|
26 "missing type annotation for 'self' in method"), |
|
27 "A102": QCoreApplication.translate( |
|
28 "AnnotationsChecker", |
|
29 "missing type annotation for 'cls' in classmethod"), |
|
30 "A201": QCoreApplication.translate( |
|
31 "AnnotationsChecker", |
|
32 "missing return type annotation for public function"), |
|
33 "A202": QCoreApplication.translate( |
|
34 "AnnotationsChecker", |
|
35 "missing return type annotation for protected function"), |
|
36 "A203": QCoreApplication.translate( |
|
37 "AnnotationsChecker", |
|
38 "missing return type annotation for private function"), |
|
39 "A204": QCoreApplication.translate( |
|
40 "AnnotationsChecker", |
|
41 "missing return type annotation for special method"), |
|
42 "A205": QCoreApplication.translate( |
|
43 "AnnotationsChecker", |
|
44 "missing return type annotation for staticmethod"), |
|
45 "A206": QCoreApplication.translate( |
|
46 "AnnotationsChecker", |
|
47 "missing return type annotation for classmethod"), |
|
48 "A301": QCoreApplication.translate( |
|
49 "AnnotationsChecker", |
|
50 "PEP 484 disallows both type annotations and type comments"), |
|
51 |
|
52 "A871": QCoreApplication.translate( |
|
53 "AnnotationsChecker", |
|
54 "missing 'from __future__ import annotations' but imports: {0}"), |
|
55 |
|
56 "A881": QCoreApplication.translate( |
|
57 "AnnotationsChecker", |
|
58 "type annotation coverage of {0}% is too low"), |
|
59 |
|
60 "A891": QCoreApplication.translate( |
|
61 "AnnotationsChecker", |
|
62 "type annotation is too complex ({0} > {1})"), |
|
63 "A892": QCoreApplication.translate( |
|
64 "AnnotationsChecker", |
|
65 "type annotation is too long ({0} > {1})"), |
|
66 } |
|
67 |
|
68 _annotationsMessagesSampleArgs = { |
|
69 "A001": ["arg1"], |
|
70 "A002": ["args"], |
|
71 "A003": ["kwargs"], |
|
72 "A871": ["Dict, List"], |
|
73 "A881": [60], |
|
74 "A891": [5, 3], |
|
75 "A892": [10, 7], |
|
76 } |