|
11 | 11 | import traceback
|
12 | 12 | import warnings
|
13 | 13 | from io import TextIOWrapper
|
14 |
| -from typing import Any, Dict, Iterable, Iterator, List, Optional, Sequence, Type, Union |
| 14 | +from typing import ( |
| 15 | + Any, |
| 16 | + DefaultDict, |
| 17 | + Dict, |
| 18 | + Iterable, |
| 19 | + Iterator, |
| 20 | + List, |
| 21 | + Optional, |
| 22 | + Sequence, |
| 23 | + Set, |
| 24 | + Type, |
| 25 | + Union, |
| 26 | +) |
15 | 27 |
|
16 | 28 | import astroid
|
17 | 29 | from astroid import AstroidError, nodes
|
@@ -537,8 +549,15 @@ def __init__(
|
537 | 549 | self._reporters: Dict[str, Type[reporters.BaseReporter]] = {}
|
538 | 550 | """Dictionary of possible but non-initialized reporters"""
|
539 | 551 |
|
| 552 | + # Attributes for checkers and plugins |
| 553 | + self._checkers: DefaultDict[ |
| 554 | + str, List[checkers.BaseChecker] |
| 555 | + ] = collections.defaultdict(list) |
| 556 | + """Dictionary of registered and initialized checkers""" |
| 557 | + self._dynamic_plugins: Set[str] = set() |
| 558 | + """Set of loaded plugin names""" |
| 559 | + |
540 | 560 | self.msgs_store = MessageDefinitionStore()
|
541 |
| - self._checkers = collections.defaultdict(list) |
542 | 561 | self._pragma_lineno = {}
|
543 | 562 |
|
544 | 563 | # Attributes related to visiting files
|
@@ -585,7 +604,6 @@ def __init__(
|
585 | 604 | ("RP0003", "Messages", report_messages_stats),
|
586 | 605 | )
|
587 | 606 | self.register_checker(self)
|
588 |
| - self._dynamic_plugins = set() |
589 | 607 | self._error_mode = False
|
590 | 608 | self.load_provider_defaults()
|
591 | 609 |
|
@@ -722,7 +740,7 @@ def report_order(self):
|
722 | 740 |
|
723 | 741 | # checkers manipulation methods ############################################
|
724 | 742 |
|
725 |
| - def register_checker(self, checker): |
| 743 | + def register_checker(self, checker: checkers.BaseChecker) -> None: |
726 | 744 | """register a new checker
|
727 | 745 |
|
728 | 746 | checker is an object implementing IRawChecker or / and IAstroidChecker
|
|
0 commit comments