mapreduce_checker.py 761 B

1234567891011121314151617181920
  1. # Copyright (c) 2020 Frank Harrison <frank@doublethefish.com>
  2. # Copyright (c) 2021 Pierre Sassoulas <pierre.sassoulas@gmail.com>
  3. # Copyright (c) 2021 Marc Mueller <30130371+cdce8p@users.noreply.github.com>
  4. # Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
  5. # For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
  6. import abc
  7. class MapReduceMixin(metaclass=abc.ABCMeta):
  8. """A mixin design to allow multiprocess/threaded runs of a Checker"""
  9. @abc.abstractmethod
  10. def get_map_data(self):
  11. """Returns mergable/reducible data that will be examined"""
  12. @classmethod
  13. @abc.abstractmethod
  14. def reduce_map_data(cls, linter, data):
  15. """For a given Checker, receives data for all mapped runs"""