Skip to content

Commit d3f32f3

Browse files
authored
Update ruff formatter (#3496)
* Update ruff formatter * Update
1 parent 9af2321 commit d3f32f3

114 files changed

Lines changed: 2932 additions & 2930 deletions

File tree

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: 33 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -25,36 +25,36 @@ def plugin(f, *args, **kwargs) -> None: # type: ignore[no-untyped-def]
2525

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

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

3737

3838
def _fetch_arch_db() -> None:
39-
info("Fetching Arch Linux package database...")
39+
info('Fetching Arch Linux package database...')
4040
try:
41-
Pacman.run("-Sy")
41+
Pacman.run('-Sy')
4242
except Exception as e:
43-
debug(f"Failed to sync Arch Linux package database: {e}")
43+
debug(f'Failed to sync Arch Linux package database: {e}')
4444
exit(1)
4545

4646

4747
def _check_new_version() -> None:
48-
info("Checking version...")
48+
info('Checking version...')
4949
upgrade = None
5050

5151
try:
52-
upgrade = Pacman.run("-Qu archinstall").decode()
52+
upgrade = Pacman.run('-Qu archinstall').decode()
5353
except Exception as e:
54-
debug(f"Failed determine pacman version: {e}")
54+
debug(f'Failed determine pacman version: {e}')
5555

5656
if upgrade:
57-
text = f"New version available: {upgrade}"
57+
text = f'New version available: {upgrade}'
5858
info(text)
5959
time.sleep(3)
6060

@@ -65,12 +65,12 @@ def main() -> int:
6565
OR straight as a module: python -m archinstall
6666
In any case we will be attempting to load the provided script to be run from the scripts/ folder
6767
"""
68-
if "--help" in sys.argv or "-h" in sys.argv:
68+
if '--help' in sys.argv or '-h' in sys.argv:
6969
arch_config_handler.print_help()
7070
return 0
7171

7272
if os.getuid() != 0:
73-
print(tr("Archinstall requires root privileges to run. See --help for more."))
73+
print(tr('Archinstall requires root privileges to run. See --help for more.'))
7474
return 1
7575

7676
_log_sys_info()
@@ -83,7 +83,7 @@ def main() -> int:
8383

8484
script = arch_config_handler.args.script
8585

86-
mod_name = f"archinstall.scripts.{script}"
86+
mod_name = f'archinstall.scripts.{script}'
8787
# by loading the module we'll automatically run the script
8888
importlib.import_module(mod_name)
8989

@@ -103,11 +103,11 @@ def run_as_a_module() -> None:
103103
Tui.shutdown()
104104

105105
if exc:
106-
err = "".join(traceback.format_exception(exc))
106+
err = ''.join(traceback.format_exception(exc))
107107
error(err)
108108

109109
text = (
110-
"Archinstall experienced the above error. If you think this is a bug, please report it to\n"
110+
'Archinstall experienced the above error. If you think this is a bug, please report it to\n'
111111
'https://github.com/archlinux/archinstall and include the log file "/var/log/archinstall/install.log".\n\n'
112112
"Hint: To extract the log from a live ISO \ncurl -F'file=@/var/log/archinstall/install.log' https://0x0.st\n"
113113
)
@@ -119,19 +119,19 @@ def run_as_a_module() -> None:
119119

120120

121121
__all__ = [
122-
"FormattedOutput",
123-
"Language",
124-
"Pacman",
125-
"SysInfo",
126-
"Tui",
127-
"arch_config_handler",
128-
"debug",
129-
"disk_layouts",
130-
"error",
131-
"info",
132-
"load_plugin",
133-
"log",
134-
"plugin",
135-
"translation_handler",
136-
"warn",
122+
'FormattedOutput',
123+
'Language',
124+
'Pacman',
125+
'SysInfo',
126+
'Tui',
127+
'arch_config_handler',
128+
'debug',
129+
'disk_layouts',
130+
'error',
131+
'info',
132+
'load_plugin',
133+
'log',
134+
'plugin',
135+
'translation_handler',
136+
'warn',
137137
]

archinstall/__main__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
import archinstall
22

3-
if __name__ == "__main__":
3+
if __name__ == '__main__':
44
archinstall.run_as_a_module()

archinstall/default_profiles/applications/pipewire.py

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -9,22 +9,22 @@
99

1010
class PipewireProfile(Profile):
1111
def __init__(self) -> None:
12-
super().__init__("Pipewire", ProfileType.Application)
12+
super().__init__('Pipewire', ProfileType.Application)
1313

1414
@property
1515
@override
1616
def packages(self) -> list[str]:
1717
return [
18-
"pipewire",
19-
"pipewire-alsa",
20-
"pipewire-jack",
21-
"pipewire-pulse",
22-
"gst-plugin-pipewire",
23-
"libpulse",
24-
"wireplumber",
18+
'pipewire',
19+
'pipewire-alsa',
20+
'pipewire-jack',
21+
'pipewire-pulse',
22+
'gst-plugin-pipewire',
23+
'libpulse',
24+
'wireplumber',
2525
]
2626

27-
def _enable_pipewire_for_all(self, install_session: "Installer") -> None:
27+
def _enable_pipewire_for_all(self, install_session: 'Installer') -> None:
2828
from archinstall.lib.args import arch_config_handler
2929

3030
users: list[User] | None = arch_config_handler.config.users
@@ -34,24 +34,24 @@ def _enable_pipewire_for_all(self, install_session: "Installer") -> None:
3434

3535
for user in users:
3636
# Create the full path for enabling the pipewire systemd items
37-
service_dir = install_session.target / "home" / user.username / ".config" / "systemd" / "user" / "default.target.wants"
37+
service_dir = install_session.target / 'home' / user.username / '.config' / 'systemd' / 'user' / 'default.target.wants'
3838
service_dir.mkdir(parents=True, exist_ok=True)
3939

4040
# Set ownership of the entire user catalogue
41-
install_session.arch_chroot(f"chown -R {user.username}:{user.username} /home/{user.username}")
41+
install_session.arch_chroot(f'chown -R {user.username}:{user.username} /home/{user.username}')
4242

4343
# symlink in the correct pipewire systemd items
4444
install_session.arch_chroot(
45-
f"ln -sf /usr/lib/systemd/user/pipewire-pulse.service /home/{user.username}/.config/systemd/user/default.target.wants/pipewire-pulse.service",
45+
f'ln -sf /usr/lib/systemd/user/pipewire-pulse.service /home/{user.username}/.config/systemd/user/default.target.wants/pipewire-pulse.service',
4646
run_as=user.username,
4747
)
4848
install_session.arch_chroot(
49-
f"ln -sf /usr/lib/systemd/user/pipewire-pulse.socket /home/{user.username}/.config/systemd/user/default.target.wants/pipewire-pulse.socket",
49+
f'ln -sf /usr/lib/systemd/user/pipewire-pulse.socket /home/{user.username}/.config/systemd/user/default.target.wants/pipewire-pulse.socket',
5050
run_as=user.username,
5151
)
5252

5353
@override
54-
def install(self, install_session: "Installer") -> None:
54+
def install(self, install_session: 'Installer') -> None:
5555
super().install(install_session)
5656
install_session.add_additional_packages(self.packages)
5757
self._enable_pipewire_for_all(install_session)

archinstall/default_profiles/desktop.py

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
class DesktopProfile(Profile):
1616
def __init__(self, current_selection: list[Profile] = []) -> None:
1717
super().__init__(
18-
"Desktop",
18+
'Desktop',
1919
ProfileType.Desktop,
2020
current_selection=current_selection,
2121
support_greeter=True,
@@ -25,16 +25,16 @@ def __init__(self, current_selection: list[Profile] = []) -> None:
2525
@override
2626
def packages(self) -> list[str]:
2727
return [
28-
"nano",
29-
"vim",
30-
"openssh",
31-
"htop",
32-
"wget",
33-
"iwd",
34-
"wireless_tools",
35-
"wpa_supplicant",
36-
"smartmontools",
37-
"xdg-utils",
28+
'nano',
29+
'vim',
30+
'openssh',
31+
'htop',
32+
'wget',
33+
'iwd',
34+
'wireless_tools',
35+
'wpa_supplicant',
36+
'smartmontools',
37+
'xdg-utils',
3838
]
3939

4040
@property
@@ -75,8 +75,8 @@ def do_on_select(self) -> SelectResult:
7575
allow_reset=True,
7676
allow_skip=True,
7777
preview_style=PreviewStyle.RIGHT,
78-
preview_size="auto",
79-
preview_frame=FrameProperties.max("Info"),
78+
preview_size='auto',
79+
preview_frame=FrameProperties.max('Info'),
8080
).run()
8181

8282
match result.type_:
@@ -90,17 +90,17 @@ def do_on_select(self) -> SelectResult:
9090
return SelectResult.ResetCurrent
9191

9292
@override
93-
def post_install(self, install_session: "Installer") -> None:
93+
def post_install(self, install_session: 'Installer') -> None:
9494
for profile in self.current_selection:
9595
profile.post_install(install_session)
9696

9797
@override
98-
def install(self, install_session: "Installer") -> None:
98+
def install(self, install_session: 'Installer') -> None:
9999
# Install common packages for all desktop environments
100100
install_session.add_additional_packages(self.packages)
101101

102102
for profile in self.current_selection:
103-
info(f"Installing profile {profile.name}...")
103+
info(f'Installing profile {profile.name}...')
104104

105105
install_session.add_additional_packages(profile.packages)
106106
install_session.enable_service(profile.services)

archinstall/default_profiles/desktops/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22

33

44
class SeatAccess(Enum):
5-
seatd = "seatd"
6-
polkit = "polkit"
5+
seatd = 'seatd'
6+
polkit = 'polkit'

archinstall/default_profiles/desktops/awesome.py

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -9,56 +9,56 @@
99

1010
class AwesomeProfile(XorgProfile):
1111
def __init__(self) -> None:
12-
super().__init__("Awesome", ProfileType.WindowMgr)
12+
super().__init__('Awesome', ProfileType.WindowMgr)
1313

1414
@property
1515
@override
1616
def packages(self) -> list[str]:
1717
return super().packages + [
18-
"awesome",
19-
"alacritty",
20-
"xorg-xinit",
21-
"xorg-xrandr",
22-
"xterm",
23-
"feh",
24-
"slock",
25-
"terminus-font",
26-
"gnu-free-fonts",
27-
"ttf-liberation",
28-
"xsel",
18+
'awesome',
19+
'alacritty',
20+
'xorg-xinit',
21+
'xorg-xrandr',
22+
'xterm',
23+
'feh',
24+
'slock',
25+
'terminus-font',
26+
'gnu-free-fonts',
27+
'ttf-liberation',
28+
'xsel',
2929
]
3030

3131
@override
32-
def install(self, install_session: "Installer") -> None:
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

52-
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}")
52+
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}')
5959

60-
xinitrc_data += "\n"
61-
xinitrc_data += "exec awesome\n"
60+
xinitrc_data += '\n'
61+
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: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,18 @@
66

77
class BspwmProfile(XorgProfile):
88
def __init__(self) -> None:
9-
super().__init__("Bspwm", ProfileType.WindowMgr)
9+
super().__init__('Bspwm', ProfileType.WindowMgr)
1010

1111
@property
1212
@override
1313
def packages(self) -> list[str]:
1414
# return super().packages + [
1515
return [
16-
"bspwm",
17-
"sxhkd",
18-
"dmenu",
19-
"xdo",
20-
"rxvt-unicode",
16+
'bspwm',
17+
'sxhkd',
18+
'dmenu',
19+
'xdo',
20+
'rxvt-unicode',
2121
]
2222

2323
@property

archinstall/default_profiles/desktops/budgie.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,17 @@
66

77
class BudgieProfile(XorgProfile):
88
def __init__(self) -> None:
9-
super().__init__("Budgie", ProfileType.DesktopEnv)
9+
super().__init__('Budgie', ProfileType.DesktopEnv)
1010

1111
@property
1212
@override
1313
def packages(self) -> list[str]:
1414
return [
15-
"materia-gtk-theme",
16-
"budgie",
17-
"mate-terminal",
18-
"nemo",
19-
"papirus-icon-theme",
15+
'materia-gtk-theme',
16+
'budgie',
17+
'mate-terminal',
18+
'nemo',
19+
'papirus-icon-theme',
2020
]
2121

2222
@property

0 commit comments

Comments
 (0)