printer_factory.py 888 B

123456789101112131415161718192021222324
  1. # Copyright (c) 2021 Pierre Sassoulas <pierre.sassoulas@gmail.com>
  2. # Copyright (c) 2021 Daniël van Noord <13665637+DanielNoord@users.noreply.github.com>
  3. # Copyright (c) 2021 Andreas Finkler <andi.finkler@gmail.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. from typing import Dict, Type
  7. from pylint.pyreverse.dot_printer import DotPrinter
  8. from pylint.pyreverse.plantuml_printer import PlantUmlPrinter
  9. from pylint.pyreverse.printer import Printer
  10. from pylint.pyreverse.vcg_printer import VCGPrinter
  11. filetype_to_printer: Dict[str, Type[Printer]] = {
  12. "vcg": VCGPrinter,
  13. "plantuml": PlantUmlPrinter,
  14. "puml": PlantUmlPrinter,
  15. "dot": DotPrinter,
  16. }
  17. def get_printer_for_filetype(filetype: str) -> Type[Printer]:
  18. return filetype_to_printer.get(filetype, DotPrinter)