printer_factory.py 910 B

123456789101112131415161718192021222324
  1. # Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
  2. # For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
  3. # Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
  4. from __future__ import annotations
  5. from pylint.pyreverse.dot_printer import DotPrinter
  6. from pylint.pyreverse.mermaidjs_printer import HTMLMermaidJSPrinter, MermaidJSPrinter
  7. from pylint.pyreverse.plantuml_printer import PlantUmlPrinter
  8. from pylint.pyreverse.printer import Printer
  9. from pylint.pyreverse.vcg_printer import VCGPrinter
  10. filetype_to_printer: dict[str, type[Printer]] = {
  11. "vcg": VCGPrinter,
  12. "plantuml": PlantUmlPrinter,
  13. "puml": PlantUmlPrinter,
  14. "mmd": MermaidJSPrinter,
  15. "html": HTMLMermaidJSPrinter,
  16. "dot": DotPrinter,
  17. }
  18. def get_printer_for_filetype(filetype: str) -> type[Printer]:
  19. return filetype_to_printer.get(filetype, DotPrinter)