Skip to content

Commit

Permalink
[MINOR] Don't use list(command) when command is used without any arg
Browse files Browse the repository at this point in the history
  • Loading branch information
Samuel FORESTIER committed Nov 28, 2020
1 parent 63425e1 commit cc7f00a
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 10 deletions.
5 changes: 1 addition & 4 deletions archey/entries/cpu.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
5 changes: 1 addition & 4 deletions archey/entries/gpu.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 2 additions & 2 deletions archey/entries/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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()
)
Expand Down

0 comments on commit cc7f00a

Please sign in to comment.