File size: 1,031 Bytes
3b83fd0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
from utils.options import *

keys = {
    "ifat": 0,
    "if": 0,
    "f": 0,
    "isat": 1,
    "(i)sat": 1,
    "is": 1,
    "s": 1,
    "all": 2,
    "a": 2,
}


def validatedPhaseInput():
    inputPhase = None
    while inputPhase is None:
        printOptions()
        inputPhase = input()

        if inputPhase.isnumeric():
            inputPhase = int(inputPhase)
            if inputPhase not in range(len(inputPhases)):
                print("\n", inputPhase, "is not a valid option")
                inputPhase = None
            else:
                return inputPhases[inputPhase]
        else:
            inputPhase = inputPhase.lower()
            if inputPhase not in keys:
                print("\n", inputPhase, "is not a valid option")
                inputPhase = None
            else:
                return inputPhases[keys[inputPhase]]

    print(
        "Something went seriously wrong, please consult the maintainer of the codebase."
    )
    return inputPhase