From 3347d04bfa8daef042cc51af24e996b111374a66 Mon Sep 17 00:00:00 2001 From: advaithm Date: Wed, 14 Apr 2021 13:46:47 +0530 Subject: fixed issues raised in a review --- archinstall/lib/user_interaction.py | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) (limited to 'archinstall') diff --git a/archinstall/lib/user_interaction.py b/archinstall/lib/user_interaction.py index 16627794..6756fb50 100644 --- a/archinstall/lib/user_interaction.py +++ b/archinstall/lib/user_interaction.py @@ -345,6 +345,7 @@ def select_language(options, show_only_country_codes=True): elif selected_language.isdigit() and (pos := int(selected_language)) <= len(languages)-1: selected_language = languages[pos] + return select_language # I'm leaving "options" on purpose here. # Since languages possibly contains a filtered version of # all possible language layouts, and we might want to write @@ -352,9 +353,9 @@ def select_language(options, show_only_country_codes=True): # go through the search step. elif selected_language in options: selected_language = options[options.index(selected_language)] + return selected_language else: - RequirementError("Selected language does not exist.") - return selected_language + print("Invalid Langue please select a valid option.") raise RequirementError("Selecting languages require a least one language to be given as an option.") @@ -383,21 +384,19 @@ def select_mirror_regions(mirrors, show_top_mirrors=True): print(' -- You can skip this step by leaving the option blank --') selected_mirror = input('Select one of the above regions to download packages from (by number or full name): ') if len(selected_mirror.strip()) == 0: - return {} - - elif selected_mirror.isdigit() and (pos := int(selected_mirror)) <= len(regions)-1: + return {"mirror": None} + + elif selected_mirror.isdigit() and int(selected_mirror) <= len(regions)-1: + # I'm leaving "mirrors" on purpose here. + # Since region possibly contains a known region of + # all possible regions, and we might want to write + # for instance Sweden (if we know that exists) without having to + # go through the search step. region = regions[int(selected_mirror)] selected_mirrors[region] = mirrors[region] - # I'm leaving "mirrors" on purpose here. - # Since region possibly contains a known region of - # all possible regions, and we might want to write - # for instance Sweden (if we know that exists) without having to - # go through the search step. elif selected_mirror in mirrors: selected_mirrors[selected_mirror] = mirrors[selected_mirror] else: - RequirementError("Selected region does not exist.") - - return selected_mirrors + print("Selected region does not exist.") - raise RequirementError("Selecting mirror region require a least one region to be given as an option.") + return selected_mirrors \ No newline at end of file -- cgit v1.2.3-70-g09d2