Remove superfluous list creation in join calls (#4119)
This commit is contained in:
parent
db6c11345a
commit
82512eed0e
|
|
@ -177,7 +177,7 @@
|
|||
# def info(self) -> Optional[ProfileInfo]:
|
||||
# enabled_profiles = [p for p in self._current_selection if p.custom_enabled]
|
||||
# if enabled_profiles:
|
||||
# details = ', '.join([p.name for p in enabled_profiles])
|
||||
# details = ', '.join(p.name for p in enabled_profiles)
|
||||
# gfx_driver = self.gfx_driver
|
||||
# return ProfileInfo(self.name, details, gfx_driver)
|
||||
#
|
||||
|
|
|
|||
|
|
@ -373,7 +373,7 @@ class DeviceHandler:
|
|||
|
||||
# for whatever reason the output sometimes contains
|
||||
# "File descriptor X leaked leaked on vgs invocation
|
||||
data = '\n'.join([raw for raw in raw_info if 'File descriptor' not in raw])
|
||||
data = '\n'.join(raw for raw in raw_info if 'File descriptor' not in raw)
|
||||
|
||||
debug(f'LVM info: {data}')
|
||||
|
||||
|
|
@ -489,7 +489,7 @@ class DeviceHandler:
|
|||
SysCommand(cmd)
|
||||
|
||||
def lvm_pv_create(self, pvs: Iterable[Path]) -> None:
|
||||
pvs_str = ' '.join([str(pv) for pv in pvs])
|
||||
pvs_str = ' '.join(str(pv) for pv in pvs)
|
||||
# Signatures are already wiped by wipefs, -f is just for safety
|
||||
cmd = f'pvcreate -f --yes {pvs_str}'
|
||||
# note flags used in scripting
|
||||
|
|
@ -500,7 +500,7 @@ class DeviceHandler:
|
|||
self.udev_sync()
|
||||
|
||||
def lvm_vg_create(self, pvs: Iterable[Path], vg_name: str) -> None:
|
||||
pvs_str = ' '.join([str(pv) for pv in pvs])
|
||||
pvs_str = ' '.join(str(pv) for pv in pvs)
|
||||
cmd = f'vgcreate --yes --force {vg_name} {pvs_str}'
|
||||
|
||||
debug(f'Creating LVM group: {cmd}')
|
||||
|
|
|
|||
|
|
@ -582,7 +582,7 @@ class GlobalMenu(AbstractMenu[None]):
|
|||
if mirror_config.optional_repositories:
|
||||
title = tr('Optional repositories')
|
||||
divider = '-' * len(title)
|
||||
repos = ', '.join([r.value for r in mirror_config.optional_repositories])
|
||||
repos = ', '.join(r.value for r in mirror_config.optional_repositories)
|
||||
output += f'{title}\n{divider}\n{repos}\n\n'
|
||||
|
||||
if mirror_config.custom_repositories:
|
||||
|
|
|
|||
|
|
@ -1549,7 +1549,7 @@ class Installer:
|
|||
f'cmdline: {kernel_params}',
|
||||
]
|
||||
config_contents += f'\n/Arch Linux ({kernel})\n'
|
||||
config_contents += '\n'.join([f' {it}' for it in entry]) + '\n'
|
||||
config_contents += '\n'.join(f' {it}' for it in entry) + '\n'
|
||||
else:
|
||||
entry = [
|
||||
'protocol: linux',
|
||||
|
|
@ -1558,7 +1558,7 @@ class Installer:
|
|||
f'module_path: {path_root}:/initramfs-{kernel}.img',
|
||||
]
|
||||
config_contents += f'\n/Arch Linux ({kernel})\n'
|
||||
config_contents += '\n'.join([f' {it}' for it in entry]) + '\n'
|
||||
config_contents += '\n'.join(f' {it}' for it in entry) + '\n'
|
||||
|
||||
config_path.write_text(config_contents)
|
||||
|
||||
|
|
|
|||
|
|
@ -483,7 +483,7 @@ def suggest_multi_disk_layout(
|
|||
if filesystem_type == FilesystemType.Btrfs:
|
||||
mount_options = select_mount_options()
|
||||
|
||||
device_paths = ', '.join([str(d.device_info.path) for d in devices])
|
||||
device_paths = ', '.join(str(d.device_info.path) for d in devices)
|
||||
|
||||
debug(f'Suggesting multi-disk-layout for devices: {device_paths}')
|
||||
debug(f'/root: {root_device.device_info.path}')
|
||||
|
|
|
|||
|
|
@ -149,7 +149,7 @@ def ask_additional_packages_to_install(
|
|||
) -> list[str]:
|
||||
repositories |= {Repository.Core, Repository.Extra}
|
||||
|
||||
respos_text = ', '.join([r.value for r in repositories])
|
||||
respos_text = ', '.join(r.value for r in repositories)
|
||||
output = tr('Repositories: {}').format(respos_text) + '\n'
|
||||
|
||||
output += tr('Loading packages...')
|
||||
|
|
|
|||
|
|
@ -275,7 +275,7 @@ class MirrorMenu(AbstractSubMenu[MirrorConfiguration]):
|
|||
def _prev_additional_repos(self, item: MenuItem) -> str | None:
|
||||
if item.value:
|
||||
repositories: list[Repository] = item.value
|
||||
repos = ', '.join([repo.value for repo in repositories])
|
||||
repos = ', '.join(repo.value for repo in repositories)
|
||||
return f'{tr("Additional repositories")}: {repos}'
|
||||
return None
|
||||
|
||||
|
|
@ -292,7 +292,7 @@ class MirrorMenu(AbstractSubMenu[MirrorConfiguration]):
|
|||
return None
|
||||
|
||||
custom_servers: list[CustomServer] = item.value
|
||||
output = '\n'.join([server.url for server in custom_servers])
|
||||
output = '\n'.join(server.url for server in custom_servers)
|
||||
return output.strip()
|
||||
|
||||
@override
|
||||
|
|
|
|||
|
|
@ -522,7 +522,7 @@ class _PartitionInfo:
|
|||
'Start': self.start.format_size(Unit.sectors, self.sector_size, include_unit=False),
|
||||
'End': end.format_size(Unit.sectors, self.sector_size, include_unit=False),
|
||||
'Size': self.length.format_highest(),
|
||||
'Flags': ', '.join([f.description for f in self.flags]),
|
||||
'Flags': ', '.join(f.description for f in self.flags),
|
||||
}
|
||||
|
||||
if self.btrfs_subvol_infos:
|
||||
|
|
@ -1044,7 +1044,7 @@ class PartitionModification:
|
|||
'FS type': self.fs_type.value if self.fs_type else 'Unknown',
|
||||
'Mountpoint': str(self.mountpoint) if self.mountpoint else '',
|
||||
'Mount options': ', '.join(self.mount_options),
|
||||
'Flags': ', '.join([f.description for f in self.flags]),
|
||||
'Flags': ', '.join(f.description for f in self.flags),
|
||||
}
|
||||
|
||||
if self.btrfs_subvols:
|
||||
|
|
|
|||
|
|
@ -243,11 +243,11 @@ class MirrorConfiguration:
|
|||
|
||||
@property
|
||||
def region_names(self) -> str:
|
||||
return '\n'.join([m.name for m in self.mirror_regions])
|
||||
return '\n'.join(m.name for m in self.mirror_regions)
|
||||
|
||||
@property
|
||||
def custom_server_urls(self) -> str:
|
||||
return '\n'.join([s.url for s in self.custom_servers])
|
||||
return '\n'.join(s.url for s in self.custom_servers)
|
||||
|
||||
def json(self) -> _MirrorConfigurationSerialization:
|
||||
regions = {}
|
||||
|
|
|
|||
|
|
@ -98,7 +98,7 @@ class Nic:
|
|||
config_str = ''
|
||||
for top, entries in config.items():
|
||||
config_str += f'[{top}]\n'
|
||||
config_str += '\n'.join([f'{k}={v}' for k, v in entries])
|
||||
config_str += '\n'.join(f'{k}={v}' for k, v in entries)
|
||||
config_str += '\n\n'
|
||||
|
||||
return config_str
|
||||
|
|
|
|||
|
|
@ -320,7 +320,7 @@ def log(
|
|||
reset: bool = False,
|
||||
font: list[Font] = [],
|
||||
) -> None:
|
||||
text = ' '.join([str(x) for x in msgs])
|
||||
text = ' '.join(str(x) for x in msgs)
|
||||
|
||||
logger.log(level, text)
|
||||
|
||||
|
|
|
|||
|
|
@ -139,7 +139,7 @@ class ProfileMenu(AbstractSubMenu[ProfileConfiguration]):
|
|||
if profile:
|
||||
if (sub_profiles := profile.current_selection) is not None:
|
||||
text += tr('Selected profiles: ')
|
||||
text += ', '.join([p.name for p in sub_profiles]) + '\n'
|
||||
text += ', '.join(p.name for p in sub_profiles) + '\n'
|
||||
|
||||
if packages := profile.packages_text(include_sub_packages=True):
|
||||
text += f'{packages}'
|
||||
|
|
|
|||
|
|
@ -136,5 +136,5 @@ def format_cols(items: list[str], header: str | None = None) -> str:
|
|||
|
||||
text += FormattedOutput.as_columns(items, col)
|
||||
# remove whitespaces on each row
|
||||
text = '\n'.join([t.strip() for t in text.split('\n')])
|
||||
text = '\n'.join(t.strip() for t in text.split('\n'))
|
||||
return text
|
||||
|
|
|
|||
|
|
@ -1160,7 +1160,7 @@ class SelectMenu[ValueT](AbstractCurses[ValueT]):
|
|||
|
||||
if len(key_handles) > 1:
|
||||
decoded = MenuKeys.decode(key)
|
||||
handles = ', '.join([k.name for k in key_handles])
|
||||
handles = ', '.join(k.name for k in key_handles)
|
||||
raise ValueError(f'Multiple key matches for key {decoded}: {handles}')
|
||||
elif len(key_handles) == 0:
|
||||
return None
|
||||
|
|
|
|||
Loading…
Reference in New Issue