From cc7f00a3b05839222a22f60194d2da42ef16ecee Mon Sep 17 00:00:00 2001 From: Samuel FORESTIER Date: Sat, 28 Nov 2020 18:55:01 +0100 Subject: [PATCH] [MINOR] Don't use `list(command)` when `command` is used without any arg --- archey/entries/cpu.py | 5 +---- archey/entries/gpu.py | 5 +---- archey/entries/model.py | 4 ++-- 3 files changed, 4 insertions(+), 10 deletions(-) diff --git a/archey/entries/cpu.py b/archey/entries/cpu.py index e791e39a..9d96fc34 100644 --- a/archey/entries/cpu.py +++ b/archey/entries/cpu.py @@ -80,10 +80,7 @@ def _parse_proc_cpuinfo(cls) -> List[Dict[str, int]]: @classmethod def _parse_lscpu_output(cls) -> List[Dict[str, int]]: """Same operation but from `lscpu` output""" - cpu_info = check_output( - ['lscpu'], - env={'LANG': 'C'}, universal_newlines=True - ) + cpu_info = check_output('lscpu', env={'LANG': 'C'}, universal_newlines=True) nb_threads = cls._THREADS_PER_CORE_REGEXP.findall(cpu_info) nb_cores = cls._CORES_PER_SOCKET_REGEXP.findall(cpu_info) diff --git a/archey/entries/gpu.py b/archey/entries/gpu.py index 4b61cdcc..da10b96a 100644 --- a/archey/entries/gpu.py +++ b/archey/entries/gpu.py @@ -24,10 +24,7 @@ def __init__(self, *args, **kwargs): def _gpu_generator() -> Iterator[str]: """Based on `lspci` output, return a generator for video controllers names""" try: - lspci_output = check_output( - ['lspci'], - universal_newlines=True - ).splitlines() + lspci_output = check_output('lspci', universal_newlines=True).splitlines() except (FileNotFoundError, CalledProcessError): return diff --git a/archey/entries/model.py b/archey/entries/model.py index a8f7fa77..5b014109 100644 --- a/archey/entries/model.py +++ b/archey/entries/model.py @@ -30,7 +30,7 @@ def _fetch_virtual_env_info(self) -> Optional[str]: try: environment = check_output( - ['systemd-detect-virt'], + 'systemd-detect-virt', stderr=DEVNULL, universal_newlines=True ).rstrip() except CalledProcessError: @@ -46,7 +46,7 @@ def _fetch_virtual_env_info(self) -> Optional[str]: try: environment = ', '.join( check_output( - ['virt-what'], + 'virt-what', stderr=DEVNULL, universal_newlines=True ).splitlines() )