Example #1
0
 def test_unit(self):
     """
     Test that it calculates good
     """
     semanas = 30
     valor = 200
     result = main(semanas, valor)
     self.assertEqual(result, '6.515,35')
Example #2
0
 def test_unit_fail(self):
     """
     Test that it calculates and return 0
     """
     semanas = 0
     valor = 200
     result = main(semanas, valor)
     self.assertEqual(result, '0,00')
Example #3
0
def main():

    # this is try so that any uncaught exception will be caught here
    try:
        # check if this is our first time of run?
        if is_first_time():
            # do all the initial setup
            initial.main()

        while True:
            periodic.main()
            time.sleep(INTERVAL)
    except Exception as e:
        line = "-" * 50
        error = traceback.format_exc()
        text = "\n" + line + "\n" + error + "\n" + line

        logs.info('Error: UNEXPECTED ERROR CAUGHT. ' + str(e) + text)
Example #4
0
def get_prediction_from_url(test_url):
    features_test = initial.main(test_url)
    # Due to updates to scikit-learn, we now need a 2D array as a parameter to the predict function.
    #features_test = np.array(features_test).reshape((1, -1))

    #clf = joblib.load('C:/xampp/htdocs/' + 'Malicious-Web-Content-Detection-Using-Machine-Learning-master' + '/classifier/random_forest.pkl')

    #pred = clf.predict(features_test)
    #return int(pred[0])

    return features_test
Example #5
0
    # if operation is of uploading file
    operation = request.form['operation']

    if operation == 'upload_file':
        # extract data from received request
        file_name = request.form['file_name']
        usr_id = request.form['user_id']
        file_data = request.files['file_data']

        if file_name.endswith(".csv"):
            # save the file data to a file
            file_operations.save_file(file_data, file_name)
            # make an entry to db as who uploaded which file
            file_operations.add_to_db(usr_id, file_name)

        elif file_name.endswith(".log"):
            # this is for collecting logs
            file_operations.update_logs_file(file_data)

        return 'upload successful'

    # if the user requested for assigning USER id
    elif operation == 'assign_usr_id':
        return str(file_operations.assign_usr_id())


if __name__ == '__main__':
    initial.main()
    app.run(debug=True, host='0.0.0.0')
Example #6
0
def main():
    initial.main(train_dir,dev_dir,test_dir)
    ner.main(train_dir,dev_dir, test_dir, lifelong_dir)