Coverage for C:\Repos\ekr-pylint\pylint\checkers\mapreduce_checker.py: 85%

13 statements  

« prev     ^ index     » next       coverage.py v6.4, created at 2022-05-24 10:21 -0500

1# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html 

2# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE 

3# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt 

4 

5from __future__ import annotations 

6 

7import abc 

8import warnings 

9from typing import TYPE_CHECKING, Any 

10 

11if TYPE_CHECKING: 

12 from pylint.lint import PyLinter 

13 

14 

15class MapReduceMixin(metaclass=abc.ABCMeta): 

16 """A mixin design to allow multi-process/threaded runs of a Checker.""" 

17 

18 def __init__(self) -> None: 

19 warnings.warn( 

20 "MapReduceMixin has been deprecated and will be removed in pylint 3.0. " 

21 "To make a checker reduce map data simply implement get_map_data and reduce_map_data.", 

22 DeprecationWarning, 

23 ) 

24 

25 @abc.abstractmethod 

26 def get_map_data(self) -> Any: 

27 """Returns merge-able/reducible data that will be examined.""" 

28 

29 @abc.abstractmethod 

30 def reduce_map_data(self, linter: PyLinter, data: list[Any]) -> None: 

31 """For a given Checker, receives data for all mapped runs."""