From b32f5e4babdf70e6f5ad60d8859bfaa633c2367f Mon Sep 17 00:00:00 2001 From: shatakshiiii Date: Tue, 11 Jul 2023 11:07:02 +0530 Subject: [PATCH] Ruff fixes --- pyproject.toml | 1 + src/ansible_navigator/utils/definitions.py | 5 +---- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 66008a423..3bb9c8294 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -279,6 +279,7 @@ ignore = [ 'N812', # Lowercase `__version_collection_doc_cache__` imported as non-lowercase `VERSION_CDC` 'N813', # Camelcase `Action` imported as lowercase `stdout_action` 'N817', # CamelCase `Constants` imported as acronym `C` + 'PERF203', # `try`-`except` within a loop incurs performance overhead 'PGH003', # Use specific rule codes when ignoring type issues 'PIE810', # [*] Call `startswith` once with a `tuple` 'PLC1901', # `self.fs_source == ""` can be simplified to `not self.fs_source` as an empty string is falsey diff --git a/src/ansible_navigator/utils/definitions.py b/src/ansible_navigator/utils/definitions.py index 59ae16364..0b462b143 100644 --- a/src/ansible_navigator/utils/definitions.py +++ b/src/ansible_navigator/utils/definitions.py @@ -132,15 +132,12 @@ def to_lines(self, color: bool, width: int, with_prefix: bool) -> list[str]: initial_indent=str(self.prefix) if with_prefix else indent, subsequent_indent=indent, ) - printable = [] lines = message.splitlines() start_color = self.color if color else "" end_color = Color.END if color else "" - for line in lines: - printable.append(f"{start_color}{line}{end_color}") - + printable = [f"{start_color}{line}{end_color}" for line in lines] return printable