Code Duplication    Length = 18-18 lines in 2 locations

marvin_general_actions.py 1 location

@@ 28-45 (lines=18) @@
25
    CONFIG = config
26
27
28
def getString(key, key1=None):
29
    """
30
    Get a string from the string database.
31
    """
32
    data = STRINGS[key]
33
    if isinstance(data, list):
34
        res = data[random.randint(0, len(data) - 1)]
35
    elif isinstance(data, dict):
36
        if key1 is None:
37
            res = data
38
        else:
39
            res = data[key1]
40
            if isinstance(res, list):
41
                res = res[random.randint(0, len(res) - 1)]
42
    elif isinstance(data, str):
43
        res = data
44
45
    return res
46
47
48
def getAllGeneralActions():

marvin_actions.py 1 location

@@ 68-85 (lines=18) @@
65
    CONFIG = config
66
67
68
def getString(key, key1=None):
69
    """
70
    Get a string from the string database.
71
    """
72
    data = STRINGS[key]
73
    if isinstance(data, list):
74
        res = data[random.randint(0, len(data) - 1)]
75
    elif isinstance(data, dict):
76
        if key1 is None:
77
            res = data
78
        else:
79
            res = data[key1]
80
            if isinstance(res, list):
81
                res = res[random.randint(0, len(res) - 1)]
82
    elif isinstance(data, str):
83
        res = data
84
85
    return res
86
87
88
def marvinSmile(row):