Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/archinstall
diff options
context:
space:
mode:
authorSecondThundeR <awayfromgalaxy@gmail.com>2021-04-23 01:08:38 +0300
committerSecondThundeR <awayfromgalaxy@gmail.com>2021-04-23 01:08:38 +0300
commit2d3d3c54ef5ec5f4311afe75d87733a27b1d7509 (patch)
tree2c9f18e362bad5650abbde7add125cb631aa4ebc /archinstall
parent839e945b87ec16129c201f731da8be12bebe6cb8 (diff)
Remove unnecessary else in try...except
This change simplifies the try...except block in generic_select by adding a break to the item selection by index
Diffstat (limited to 'archinstall')
-rw-r--r--archinstall/lib/user_interaction.py5
1 files changed, 2 insertions, 3 deletions
diff --git a/archinstall/lib/user_interaction.py b/archinstall/lib/user_interaction.py
index dcb51e2a..572acf4f 100644
--- a/archinstall/lib/user_interaction.py
+++ b/archinstall/lib/user_interaction.py
@@ -277,7 +277,7 @@ def generic_select(options, input_text="Select one of the above by index or abso
print(f"{index}: {option}")
# The new changes introduce a single while loop for all inputs processed by this function
- # Now the try...except...else block handles validation for invalid input from the user
+ # Now the try...except block handles validation for invalid input from the user
while True:
try:
selected_option = input(input_text)
@@ -293,6 +293,7 @@ def generic_select(options, input_text="Select one of the above by index or abso
if selected_option >= len(options):
raise RequirementError(f'Selected option "{selected_option}" is out of range')
selected_option = options[selected_option]
+ break
elif selected_option in options:
break # We gave a correct absolute value
else:
@@ -300,8 +301,6 @@ def generic_select(options, input_text="Select one of the above by index or abso
except RequirementError as err:
log(f" * {err} * ", fg='red')
continue
- else:
- break
return selected_option