Code Duplication    Length = 18-18 lines in 2 locations

marvin_actions.py 1 location

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

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():