Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDylan Taylor <dylan@dylanmtaylor.com>2021-05-15 15:18:46 -0400
committerDylan Taylor <dylan@dylanmtaylor.com>2021-05-15 15:18:46 -0400
commitf7642786c9e169245fae52d8754b9d68f2507cb7 (patch)
tree6a02d6a4952af4c2578425ee799def8337fd63c8
parent55b09aa1eb4e5ec83d826b8a3dd10670d674aad7 (diff)
Remove some redundant parenthesis
-rw-r--r--archinstall/lib/disk.py10
-rw-r--r--archinstall/lib/installer.py8
-rw-r--r--archinstall/lib/mirrors.py8
-rw-r--r--archinstall/lib/user_interaction.py6
-rw-r--r--docs/archinstall/general.rst2
-rw-r--r--examples/guided.py2
6 files changed, 18 insertions, 18 deletions
diff --git a/archinstall/lib/disk.py b/archinstall/lib/disk.py
index 85e8a402..00a6cae3 100644
--- a/archinstall/lib/disk.py
+++ b/archinstall/lib/disk.py
@@ -179,11 +179,11 @@ class Partition:
if self.mountpoint != mount_information.get('target', None) and mountpoint:
raise DiskError(f"{self} was given a mountpoint but the actual mountpoint differs: {mount_information.get('target', None)}")
- if (target := mount_information.get('target', None)):
+ if target := mount_information.get('target', None):
self.mountpoint = target
if not self.filesystem and autodetect_filesystem:
- if (fstype := mount_information.get('fstype', get_filesystem_type(path))):
+ if fstype := mount_information.get('fstype', get_filesystem_type(path)):
self.filesystem = fstype
if self.filesystem == 'crypto_LUKS':
@@ -236,7 +236,7 @@ class Partition:
@property
def real_device(self):
for blockdevice in json.loads(b''.join(sys_command('lsblk -J')).decode('UTF-8'))['blockdevices']:
- if (parent := self.find_parent_of(blockdevice, os.path.basename(self.path))):
+ if parent := self.find_parent_of(blockdevice, os.path.basename(self.path)):
return f"/dev/{parent}"
# raise DiskError(f'Could not find appropriate parent for encrypted partition {self}')
return self.path
@@ -373,7 +373,7 @@ class Partition:
return parent
elif 'children' in data:
for child in data['children']:
- if (parent := self.find_parent_of(child, name, parent=data['name'])):
+ if parent := self.find_parent_of(child, name, parent=data['name']):
return parent
def mount(self, target, fs=None, options=''):
@@ -403,7 +403,7 @@ class Partition:
# Without to much research, it seams that low error codes are errors.
# And above 8k is indicators such as "/dev/x not mounted.".
# So anything in between 0 and 8k are errors (?).
- if exit_code > 0 and exit_code < 8000:
+ if 0 < exit_code < 8000:
raise err
self.mountpoint = None
diff --git a/archinstall/lib/installer.py b/archinstall/lib/installer.py
index 139d9d33..cdf69273 100644
--- a/archinstall/lib/installer.py
+++ b/archinstall/lib/installer.py
@@ -107,7 +107,7 @@ class Installer:
# Copy over the install log (if there is one) to the install medium if
# at least the base has been strapped in, otherwise we won't have a filesystem/structure to copy to.
if self.helper_flags.get('base-strapped', False) is True:
- if (filename := storage.get('LOG_FILE', None)):
+ if filename := storage.get('LOG_FILE', None):
absolute_logfile = os.path.join(storage.get('LOG_PATH', './'), filename)
if not os.path.isdir(f"{self.target}/{os.path.dirname(absolute_logfile)}"):
@@ -231,7 +231,7 @@ class Installer:
def copy_ISO_network_config(self, enable_services=False):
# Copy (if any) iwd password and config files
if os.path.isdir('/var/lib/iwd/'):
- if (psk_files := glob.glob('/var/lib/iwd/*.psk')):
+ if psk_files := glob.glob('/var/lib/iwd/*.psk'):
if not os.path.isdir(f"{self.target}/var/lib/iwd"):
os.makedirs(f"{self.target}/var/lib/iwd")
@@ -257,7 +257,7 @@ class Installer:
shutil.copy2(psk, f"{self.target}/var/lib/iwd/{os.path.basename(psk)}")
# Copy (if any) systemd-networkd config files
- if (netconfigurations := glob.glob('/etc/systemd/network/*')):
+ if netconfigurations := glob.glob('/etc/systemd/network/*'):
if not os.path.isdir(f"{self.target}/etc/systemd/network/"):
os.makedirs(f"{self.target}/etc/systemd/network/")
@@ -426,7 +426,7 @@ class Installer:
## blkid doesn't trigger on loopback devices really well,
## so we'll use the old manual method until we get that sorted out.
- if (real_device := self.detect_encryption(root_partition)):
+ if real_device := self.detect_encryption(root_partition):
# TODO: We need to detect if the encrypted device is a whole disk encryption,
# or simply a partition encryption. Right now we assume it's a partition (and we always have)
log(f"Identifying root partition by PART-UUID on {real_device}: '{real_device.uuid}'.", level=logging.DEBUG)
diff --git a/archinstall/lib/mirrors.py b/archinstall/lib/mirrors.py
index e2630710..55ec5a98 100644
--- a/archinstall/lib/mirrors.py
+++ b/archinstall/lib/mirrors.py
@@ -15,9 +15,9 @@ def filter_mirrors_by_region(regions, destination='/etc/pacman.d/mirrorlist', tm
region_list = []
for region in regions.split(','):
region_list.append(f'country={region}')
- o = b''.join(sys_command((f"/usr/bin/wget 'https://archlinux.org/mirrorlist/?{'&'.join(region_list)}&protocol=https&ip_version=4&ip_version=6&use_mirror_status=on' -O {tmp_dir}/mirrorlist")))
- o = b''.join(sys_command((f"/usr/bin/sed -i 's/#Server/Server/' {tmp_dir}/mirrorlist")))
- o = b''.join(sys_command((f"/usr/bin/mv {tmp_dir}/mirrorlist {destination}")))
+ o = b''.join(sys_command(f"/usr/bin/wget 'https://archlinux.org/mirrorlist/?{'&'.join(region_list)}&protocol=https&ip_version=4&ip_version=6&use_mirror_status=on' -O {tmp_dir}/mirrorlist"))
+ o = b''.join(sys_command(f"/usr/bin/sed -i 's/#Server/Server/' {tmp_dir}/mirrorlist"))
+ o = b''.join(sys_command(f"/usr/bin/mv {tmp_dir}/mirrorlist {destination}"))
return True
@@ -71,7 +71,7 @@ def use_mirrors(regions: dict, destination='/etc/pacman.d/mirrorlist'):
def re_rank_mirrors(top=10, *positionals, **kwargs):
- if sys_command((f'/usr/bin/rankmirrors -n {top} /etc/pacman.d/mirrorlist > /etc/pacman.d/mirrorlist')).exit_code == 0:
+ if sys_command(f'/usr/bin/rankmirrors -n {top} /etc/pacman.d/mirrorlist > /etc/pacman.d/mirrorlist').exit_code == 0:
return True
return False
diff --git a/archinstall/lib/user_interaction.py b/archinstall/lib/user_interaction.py
index 6289ef0a..d490aeec 100644
--- a/archinstall/lib/user_interaction.py
+++ b/archinstall/lib/user_interaction.py
@@ -85,7 +85,7 @@ def do_countdown():
def get_password(prompt="Enter a password: "):
- while (passwd := getpass.getpass(prompt)):
+ while passwd := getpass.getpass(prompt):
passwd_verification = getpass.getpass(prompt='And one more time for verification: ')
if passwd != passwd_verification:
log(' * Passwords did not match * ', fg='red')
@@ -246,7 +246,7 @@ class MiniCurses:
return True
# Move back to the current known position (BACKSPACE doesn't updated x-pos)
sys.stdout.flush()
- sys.stdout.write("\033[%dG" % (self._cursor_x))
+ sys.stdout.write("\033[%dG" % self._cursor_x)
sys.stdout.flush()
# Write a blank space
@@ -256,7 +256,7 @@ class MiniCurses:
# And move back again
sys.stdout.flush()
- sys.stdout.write("\033[%dG" % (self._cursor_x))
+ sys.stdout.write("\033[%dG" % self._cursor_x)
sys.stdout.flush()
self._cursor_x -= 1
diff --git a/docs/archinstall/general.rst b/docs/archinstall/general.rst
index 7319d244..79406ea3 100644
--- a/docs/archinstall/general.rst
+++ b/docs/archinstall/general.rst
@@ -1,7 +1,7 @@
.. _archinstall.helpers:
.. warning::
- All these helper functions are mostly, if not all, related to outside-installation-instructions. Meaning the calls will affect your current running system - and not touch your installed system.
+ All these helper functions are mostly, if not all, related to outside-installation-instructions. Meaning the calls will affect your current running system - and not touch your installed system.
Profile related helpers
=======================
diff --git a/examples/guided.py b/examples/guided.py
index a1a49448..e9873ef0 100644
--- a/examples/guided.py
+++ b/examples/guided.py
@@ -104,7 +104,7 @@ def ask_user_questions():
if not old_password:
old_password = input(f'Enter the old encryption password for {partition}: ')
- if (autodetected_filesystem := partition.detect_inner_filesystem(old_password)):
+ if autodetected_filesystem := partition.detect_inner_filesystem(old_password):
new_filesystem = autodetected_filesystem
else:
archinstall.log("Could not auto-detect the filesystem inside the encrypted volume.", fg='red')