From 50c893f660627eae362a4051ff1dea498c8c3109 Mon Sep 17 00:00:00 2001 From: Ole-Jakob Olsen Date: Wed, 12 Jun 2024 18:30:39 +0200 Subject: [PATCH] Refactor, more descriptive function name --- htpy/html2htpy.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/htpy/html2htpy.py b/htpy/html2htpy.py index a098178..366ec9f 100644 --- a/htpy/html2htpy.py +++ b/htpy/html2htpy.py @@ -266,7 +266,7 @@ def _get_formatter( ) -> Formatter | None: formatter: Formatter | None = None if format == "ruff": - if _is_package_installed("ruff"): + if _is_command_available("ruff"): formatter = RuffFormatter() else: _printerr( @@ -277,7 +277,7 @@ def _get_formatter( sys.exit(1) if format == "black": - if _is_package_installed("black"): + if _is_command_available("black"): formatter = BlackFormatter() else: _printerr( @@ -288,16 +288,16 @@ def _get_formatter( sys.exit(1) elif format == "auto": - if _is_package_installed("ruff"): + if _is_command_available("ruff"): formatter = RuffFormatter() - elif _is_package_installed("black"): + elif _is_command_available("black"): formatter = BlackFormatter() return formatter -def _is_package_installed(package_name: str): - return shutil.which(package_name) is not None +def _is_command_available(command: str): + return shutil.which(command) is not None def main():