Exemple #1
0
def replace_with_emphases(text):
    word_list = word_non_list(text)
    if is_ua_letter(word_list[0][0]):
        i = 0
    else:
        i = 1
    while i < len(word_list):
        emphasis_request = db.retrieve("ukrainian_dict",
                                       lowercase(word_list[i]))
        if "accent" in emphasis_request and type(emphasis_request) is dict:
            emphasis_raw = lowercase(emphasis_request["accent"])
            emphasis = ""
            j = 0
            k = 0
            while j < len(emphasis_raw):
                while k < len(word_list[i]):
                    if emphasis_raw[j] == lowercase(word_list[i][k]):
                        emphasis += word_list[i][k]
                        j += 1
                        k += 1
                    else:
                        emphasis += emphasis_raw[j]
                        j += 1
            word_list[i] = emphasis
        i += 2
    text = "".join(word_list)
    return text
Exemple #2
0
def log():
    method = request.method
    values = getValues(request)
    try:
        if method == "GET":
            return jsonify(database.retrieve(connection)), 200
        elif method == "POST":
            database.create(connection, values["id"], values["message"])
            return jsonify({"message": "success"}), 200
    except KeyError:  # means that data was not passed in the correct way
        abort(406)
    except TypeError:  # means that the data that the user passed cannot be converted into the needed format
        abort(406)
    except Exception as exception:  # something went wrong in this function
        return jsonify({"message": str(exception)})
Exemple #3
0
def getreports():
    data = json.loads(request.data)

    if data.get('longitude') == None or data.get('latitude') == None:
        success = False
    else:
        longitude = float(data.get('longitude'))
        latitiude = float(data.get('latitude'))
        lower_lat = latitiude - (2.5*CONV)
        upper_lat = latitiude + (2.5*CONV)
        lower_long = longitude - (2.5*CONV)
        upper_long = longitude + (2.5*CONV)
        success = True

    if success == False:
        return json.dumps({"status": "error"})
    else:
        return retrieve(upper_lat, lower_lat, upper_long, lower_long)
Exemple #4
0
def userpass_get():
    return db.retrieve("userpass","1")
Exemple #5
0
 def get(self):
     return db.retrieve("userdata",self.email)
def main():
    iterations = 1000000  #Number of times you want to play the game
    all_strengths = db.retrieve("ttt_state", "1")
    for i in range(iterations):
        all_strengths = play_game(all_strengths)
    db.send("ttt_state", all_strengths, "1")
Exemple #7
0
def admin_index():
    entries =  retrieve()
    return render_template('admin_index.html',
                title = 'Admin - Stuff',
                entries = entries)
Exemple #8
0
def admin_index():
    entries = retrieve()
    return render_template('admin_index.html',
                           title='Admin - Stuff',
                           entries=entries)