Skip to content

Commit a08187e

Browse files
committed
Ruff formatting
1 parent e61b966 commit a08187e

95 files changed

Lines changed: 983 additions & 2789 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

archinstall/__init__.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -31,31 +31,31 @@ def plugin(f, *args, **kwargs) -> None: # type: ignore[no-untyped-def]
3131

3232
def _log_sys_info() -> None:
3333
# Log various information about hardware before starting the installation. This might assist in troubleshooting
34-
debug(f"Hardware model detected: {SysInfo.sys_vendor()} {SysInfo.product_name()}; UEFI mode: {SysInfo.has_uefi()}")
35-
debug(f"Processor model detected: {SysInfo.cpu_model()}")
36-
debug(f"Memory statistics: {SysInfo.mem_available()} available out of {SysInfo.mem_total()} total installed")
37-
debug(f"Virtualization detected: {SysInfo.virtualization()}; is VM: {SysInfo.is_vm()}")
38-
debug(f"Graphics devices detected: {SysInfo._graphics_devices().keys()}")
34+
debug(f'Hardware model detected: {SysInfo.sys_vendor()} {SysInfo.product_name()}; UEFI mode: {SysInfo.has_uefi()}')
35+
debug(f'Processor model detected: {SysInfo.cpu_model()}')
36+
debug(f'Memory statistics: {SysInfo.mem_available()} available out of {SysInfo.mem_total()} total installed')
37+
debug(f'Virtualization detected: {SysInfo.virtualization()}; is VM: {SysInfo.is_vm()}')
38+
debug(f'Graphics devices detected: {SysInfo._graphics_devices().keys()}')
3939

4040
# For support reasons, we'll log the disk layout pre installation to match against post-installation layout
41-
debug(f"Disk states before installing:\n{disk_layouts()}")
41+
debug(f'Disk states before installing:\n{disk_layouts()}')
4242

4343

4444
def _fetch_arch_db() -> None:
45-
info("Fetching Arch Linux package database...")
45+
info('Fetching Arch Linux package database...')
4646
try:
47-
Pacman.run("-Sy")
47+
Pacman.run('-Sy')
4848
except Exception as e:
4949
debug(f'Failed to sync Arch Linux package database: {e}')
5050
exit(1)
5151

5252

5353
def _check_new_version() -> None:
54-
info("Checking version...")
54+
info('Checking version...')
5555
upgrade = None
5656

5757
try:
58-
upgrade = Pacman.run("-Qu archinstall").decode()
58+
upgrade = Pacman.run('-Qu archinstall').decode()
5959
except Exception as e:
6060
debug(f'Failed determine pacman version: {e}')
6161

@@ -76,7 +76,7 @@ def main() -> int:
7676
return 0
7777

7878
if os.getuid() != 0:
79-
print(_("Archinstall requires root privileges to run. See --help for more."))
79+
print(_('Archinstall requires root privileges to run. See --help for more.'))
8080
return 1
8181

8282
_log_sys_info()
@@ -115,7 +115,7 @@ def run_as_a_module() -> None:
115115
text = (
116116
'Archinstall experienced the above error. If you think this is a bug, please report it to\n'
117117
'https://github.com/archlinux/archinstall and include the log file "/var/log/archinstall/install.log".\n\n'
118-
'Hint: To extract the log from a live ISO \ncurl -F\'file=@/var/log/archinstall/install.log\' https://0x0.st\n'
118+
"Hint: To extract the log from a live ISO \ncurl -F'file=@/var/log/archinstall/install.log' https://0x0.st\n"
119119
)
120120

121121
warn(text)

archinstall/default_profiles/applications/pipewire.py

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -14,26 +14,19 @@ def __init__(self) -> None:
1414
@property
1515
@override
1616
def packages(self) -> list[str]:
17-
return [
18-
'pipewire',
19-
'pipewire-alsa',
20-
'pipewire-jack',
21-
'pipewire-pulse',
22-
'gst-plugin-pipewire',
23-
'libpulse',
24-
'wireplumber'
25-
]
17+
return ['pipewire', 'pipewire-alsa', 'pipewire-jack', 'pipewire-pulse', 'gst-plugin-pipewire', 'libpulse', 'wireplumber']
2618

2719
def _enable_pipewire_for_all(self, install_session: 'Installer') -> None:
2820
from archinstall.lib.args import arch_config_handler
21+
2922
users: list[User] | None = arch_config_handler.config.users
3023

3124
if users is None:
3225
return
3326

3427
for user in users:
3528
# Create the full path for enabling the pipewire systemd items
36-
service_dir = install_session.target / "home" / user.username / ".config" / "systemd" / "user" / "default.target.wants"
29+
service_dir = install_session.target / 'home' / user.username / '.config' / 'systemd' / 'user' / 'default.target.wants'
3730
service_dir.mkdir(parents=True, exist_ok=True)
3831

3932
# Set ownership of the entire user catalogue
@@ -42,11 +35,11 @@ def _enable_pipewire_for_all(self, install_session: 'Installer') -> None:
4235
# symlink in the correct pipewire systemd items
4336
install_session.arch_chroot(
4437
f'ln -sf /usr/lib/systemd/user/pipewire-pulse.service /home/{user.username}/.config/systemd/user/default.target.wants/pipewire-pulse.service',
45-
run_as=user.username
38+
run_as=user.username,
4639
)
4740
install_session.arch_chroot(
4841
f'ln -sf /usr/lib/systemd/user/pipewire-pulse.socket /home/{user.username}/.config/systemd/user/default.target.wants/pipewire-pulse.socket',
49-
run_as=user.username
42+
run_as=user.username,
5043
)
5144

5245
@override

archinstall/default_profiles/desktop.py

Lines changed: 4 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -14,28 +14,12 @@
1414

1515
class DesktopProfile(Profile):
1616
def __init__(self, current_selection: list[Profile] = []) -> None:
17-
super().__init__(
18-
'Desktop',
19-
ProfileType.Desktop,
20-
current_selection=current_selection,
21-
support_greeter=True
22-
)
17+
super().__init__('Desktop', ProfileType.Desktop, current_selection=current_selection, support_greeter=True)
2318

2419
@property
2520
@override
2621
def packages(self) -> list[str]:
27-
return [
28-
'nano',
29-
'vim',
30-
'openssh',
31-
'htop',
32-
'wget',
33-
'iwd',
34-
'wireless_tools',
35-
'wpa_supplicant',
36-
'smartmontools',
37-
'xdg-utils'
38-
]
22+
return ['nano', 'vim', 'openssh', 'htop', 'wget', 'iwd', 'wireless_tools', 'wpa_supplicant', 'smartmontools', 'xdg-utils']
3923

4024
@property
4125
@override
@@ -57,13 +41,7 @@ def _do_on_select_profiles(self) -> None:
5741

5842
@override
5943
def do_on_select(self) -> SelectResult:
60-
items = [
61-
MenuItem(
62-
p.name,
63-
value=p,
64-
preview_action=lambda x: x.value.preview_text()
65-
) for p in profile_handler.get_desktop_profiles()
66-
]
44+
items = [MenuItem(p.name, value=p, preview_action=lambda x: x.value.preview_text()) for p in profile_handler.get_desktop_profiles()]
6745

6846
group = MenuItemGroup(items, sort_items=True, sort_case_sensitive=False)
6947
group.set_selected_by_value(self.current_selection)
@@ -75,7 +53,7 @@ def do_on_select(self) -> SelectResult:
7553
allow_skip=True,
7654
preview_style=PreviewStyle.RIGHT,
7755
preview_size='auto',
78-
preview_frame=FrameProperties.max('Info')
56+
preview_frame=FrameProperties.max('Info'),
7957
).run()
8058

8159
match result.type_:

archinstall/default_profiles/desktops/awesome.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -33,32 +33,32 @@ def install(self, install_session: 'Installer') -> None:
3333
super().install(install_session)
3434

3535
# TODO: Copy a full configuration to ~/.config/awesome/rc.lua instead.
36-
with open(f"{install_session.target}/etc/xdg/awesome/rc.lua") as fh:
36+
with open(f'{install_session.target}/etc/xdg/awesome/rc.lua') as fh:
3737
awesome_lua = fh.read()
3838

3939
# Replace xterm with alacritty for a smoother experience.
4040
awesome_lua = awesome_lua.replace('"xterm"', '"alacritty"')
4141

42-
with open(f"{install_session.target}/etc/xdg/awesome/rc.lua", 'w') as fh:
42+
with open(f'{install_session.target}/etc/xdg/awesome/rc.lua', 'w') as fh:
4343
fh.write(awesome_lua)
4444

4545
# TODO: Configure the right-click-menu to contain the above packages that were installed. (as a user config)
4646

4747
# TODO: check if we selected a greeter,
4848
# but for now, awesome is intended to run without one.
49-
with open(f"{install_session.target}/etc/X11/xinit/xinitrc") as xinitrc:
49+
with open(f'{install_session.target}/etc/X11/xinit/xinitrc') as xinitrc:
5050
xinitrc_data = xinitrc.read()
5151

5252
for line in xinitrc_data.split('\n'):
53-
if "twm &" in line:
54-
xinitrc_data = xinitrc_data.replace(line, f"# {line}")
55-
if "xclock" in line:
56-
xinitrc_data = xinitrc_data.replace(line, f"# {line}")
57-
if "xterm" in line:
58-
xinitrc_data = xinitrc_data.replace(line, f"# {line}")
53+
if 'twm &' in line:
54+
xinitrc_data = xinitrc_data.replace(line, f'# {line}')
55+
if 'xclock' in line:
56+
xinitrc_data = xinitrc_data.replace(line, f'# {line}')
57+
if 'xterm' in line:
58+
xinitrc_data = xinitrc_data.replace(line, f'# {line}')
5959

6060
xinitrc_data += '\n'
6161
xinitrc_data += 'exec awesome\n'
6262

63-
with open(f"{install_session.target}/etc/X11/xinit/xinitrc", 'w') as xinitrc:
63+
with open(f'{install_session.target}/etc/X11/xinit/xinitrc', 'w') as xinitrc:
6464
xinitrc.write(xinitrc_data)

archinstall/default_profiles/desktops/bspwm.py

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,7 @@ def __init__(self) -> None:
1212
@override
1313
def packages(self) -> list[str]:
1414
# return super().packages + [
15-
return [
16-
'bspwm',
17-
'sxhkd',
18-
'dmenu',
19-
'xdo',
20-
'rxvt-unicode'
21-
]
15+
return ['bspwm', 'sxhkd', 'dmenu', 'xdo', 'rxvt-unicode']
2216

2317
@property
2418
@override

archinstall/default_profiles/desktops/budgie.py

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,7 @@ def __init__(self) -> None:
1111
@property
1212
@override
1313
def packages(self) -> list[str]:
14-
return [
15-
"materia-gtk-theme",
16-
"budgie",
17-
"mate-terminal",
18-
"nemo",
19-
"papirus-icon-theme"
20-
]
14+
return ['materia-gtk-theme', 'budgie', 'mate-terminal', 'nemo', 'papirus-icon-theme']
2115

2216
@property
2317
@override

archinstall/default_profiles/desktops/cinnamon.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,17 @@ def __init__(self) -> None:
1212
@override
1313
def packages(self) -> list[str]:
1414
return [
15-
"cinnamon",
16-
"system-config-printer",
17-
"gnome-keyring",
18-
"gnome-terminal",
19-
"blueman",
20-
"bluez-utils",
21-
"engrampa",
22-
"gnome-screenshot",
23-
"gvfs-smb",
24-
"xed",
25-
"xdg-user-dirs-gtk"
15+
'cinnamon',
16+
'system-config-printer',
17+
'gnome-keyring',
18+
'gnome-terminal',
19+
'blueman',
20+
'bluez-utils',
21+
'engrampa',
22+
'gnome-screenshot',
23+
'gvfs-smb',
24+
'xed',
25+
'xdg-user-dirs-gtk',
2626
]
2727

2828
@property

archinstall/default_profiles/desktops/cosmic.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ def __init__(self) -> None:
1212
@override
1313
def packages(self) -> list[str]:
1414
return [
15-
"cosmic",
15+
'cosmic',
1616
]
1717

1818
@property

archinstall/default_profiles/desktops/cutefish.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,7 @@ def __init__(self) -> None:
1111
@property
1212
@override
1313
def packages(self) -> list[str]:
14-
return [
15-
"cutefish",
16-
"noto-fonts"
17-
]
14+
return ['cutefish', 'noto-fonts']
1815

1916
@property
2017
@override

archinstall/default_profiles/desktops/deepin.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,7 @@ def __init__(self) -> None:
1111
@property
1212
@override
1313
def packages(self) -> list[str]:
14-
return [
15-
"deepin",
16-
"deepin-terminal",
17-
"deepin-editor"
18-
]
14+
return ['deepin', 'deepin-terminal', 'deepin-editor']
1915

2016
@property
2117
@override

0 commit comments

Comments
 (0)