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