diff --git a/cyclonedx_py/client.py b/cyclonedx_py/client.py index 53167c71d..81873e333 100644 --- a/cyclonedx_py/client.py +++ b/cyclonedx_py/client.py @@ -255,8 +255,10 @@ def _error_and_exit(message: str, *args: Any, exit_code: int = 1, **kwargs: Any) def _get_input_parser(self) -> BaseParser: if self._arguments.input_from_environment: - return EnvironmentParser(use_purl_bom_ref=self._arguments.use_purl_bom_ref, - debug_message=lambda m, *a, **k: self._debug_message(f'EnvironmentParser - {m}', *a, **k)) + return EnvironmentParser( + use_purl_bom_ref=self._arguments.use_purl_bom_ref, + debug_message=lambda m, *a, **k: self._debug_message(f'EnvironmentParser - {m}', *a, **k) + ) # All other Parsers will require some input - grab it now! if not self._arguments.input_source: @@ -288,25 +290,35 @@ def _get_input_parser(self) -> BaseParser: input_data_fh.close() if self._arguments.input_from_conda_explicit: - return CondaListExplicitParser(conda_data=input_data, - use_purl_bom_ref=self._arguments.use_purl_bom_ref, - debug_message=lambda m, *a, **k: self._debug_message(f'CondaListExplicitParser - {m}', *a, **k)) + return CondaListExplicitParser( + conda_data=input_data, + use_purl_bom_ref=self._arguments.use_purl_bom_ref, + debug_message=lambda m, *a, **k: self._debug_message(f'CondaListExplicitParser - {m}', *a, **k) + ) elif self._arguments.input_from_conda_json: - return CondaListJsonParser(conda_data=input_data, - use_purl_bom_ref=self._arguments.use_purl_bom_ref, - debug_message=lambda m, *a, **k: self._debug_message(f'CondaListJsonParser - {m}', *a, **k)) + return CondaListJsonParser( + conda_data=input_data, + use_purl_bom_ref=self._arguments.use_purl_bom_ref, + debug_message=lambda m, *a, **k: self._debug_message(f'CondaListJsonParser - {m}', *a, **k) + ) elif self._arguments.input_from_pip: - return PipEnvParser(pipenv_contents=input_data, - use_purl_bom_ref=self._arguments.use_purl_bom_ref, - debug_message=lambda m, *a, **k: self._debug_message(f'PipEnvParser - {m}', *a, **k)) + return PipEnvParser( + pipenv_contents=input_data, + use_purl_bom_ref=self._arguments.use_purl_bom_ref, + debug_message=lambda m, *a, **k: self._debug_message(f'PipEnvParser - {m}', *a, **k) + ) elif self._arguments.input_from_poetry: - return PoetryParser(poetry_lock_contents=input_data, - use_purl_bom_ref=self._arguments.use_purl_bom_ref, - debug_message=lambda m, *a, **k: self._debug_message(f'PoetryParser - {m}', *a, **k)) + return PoetryParser( + poetry_lock_contents=input_data, + use_purl_bom_ref=self._arguments.use_purl_bom_ref, + debug_message=lambda m, *a, **k: self._debug_message(f'PoetryParser - {m}', *a, **k) + ) elif self._arguments.input_from_requirements: - return RequirementsParser(requirements_content=input_data, - use_purl_bom_ref=self._arguments.use_purl_bom_ref, - debug_message=lambda m, *a, **k: self._debug_message(f'RequirementsParser - {m}', *a, **k)) + return RequirementsParser( + requirements_content=input_data, + use_purl_bom_ref=self._arguments.use_purl_bom_ref, + debug_message=lambda m, *a, **k: self._debug_message(f'RequirementsParser - {m}', *a, **k) + ) else: raise CycloneDxCmdException('Parser type could not be determined.') diff --git a/cyclonedx_py/parser/_debug.py b/cyclonedx_py/parser/_debug.py index b0b1ec1ac..d924d3ee8 100644 --- a/cyclonedx_py/parser/_debug.py +++ b/cyclonedx_py/parser/_debug.py @@ -24,10 +24,10 @@ DebugMessageCallback = Callable[[Arg(str, 'message'), VarArg(Any), KwArg(Any)], None] """Callback for debug messaging. - - :param message: the format string, + + :Parameter message: the format string :Other Parameters: the *args: to :func:`str.forma()` - :Keyword Arguments: the **kwargs to :func:`str.format()`. + :Keyword Arguments: the **kwargs to :func:`str.format()` """ else: DebugMessageCallback = Callable[..., None] diff --git a/cyclonedx_py/parser/requirements.py b/cyclonedx_py/parser/requirements.py index 98847f6bf..303f9f3e6 100644 --- a/cyclonedx_py/parser/requirements.py +++ b/cyclonedx_py/parser/requirements.py @@ -20,7 +20,6 @@ import os import os.path from tempfile import NamedTemporaryFile, _TemporaryFileWrapper # Weak error -from typing import Any, Optional from cyclonedx.model import HashType from cyclonedx.model.component import Component