Exemplo n.º 1
0
def register():
    print("=======================================")
    print("********** Register *******************")
    print("========================================")
    first_name = input("Please enter your first name: \n")
    last_name = input("Enter your last name: \n")
    email = input("Enter your email: \n")
    password = input("Enter your password: \n")

    account_number = account.generating_account()

    is_user_created = database.create(account_number, first_name, last_name, email, password)

    if is_user_created:
        loading.load()
        print("=======================================")
        print("Registration Successful")
        print("========================================")
        print(f"Your account number is : {account_number}")
        print(f"{first_name} {last_name}, your account has been successful created!", sep=" ")
        print("You can now login")
        login()
    else:
        print("Something went wrong, please try again!")
        loading.load()
        register()
Exemplo n.º 2
0
def update_profile(account_from_user):
    print("What would you like to edit:")
    print("> 1. First Name")
    print("> 2. Last Name")
    print("> 3. Email")
    print("> 4. Delete Account")
    option = int(input("> "))
    loading.load()
    if option == 1:
        first_name = input("What would you like to change your first name to?")
        sql.update.update_fname(account_from_user, first_name)
        print(f"Your new First name is : {first_name}")
    elif option == 2:
        last_name = input("What would you like to change your last name to?")
        sql.update.update_fname(account_from_user, last_name)
        print(f"Your new last name is : {last_name}")
    elif option == 3:
        email = input("What would you like to change your email to?")
        sql.update.update_fname(account_from_user, email)
        print(f"Your new First name is : {email}")
    elif option == 4:
        loading.load()
        sql.delete_user(account_from_user)
    else:
        print("Invalid option")
        update_profile(account_from_user)
Exemplo n.º 3
0
def bank_operations(user):
    loading.load()
    print("==========================================================")
    print("********** What would you like to do? *******************")
    print("==========================================================")
    print("> 1. Withdraw")
    print("> 2. Deposit")
    print("> 3. Request a Loan")
    print("> 4. View account profile")
    input("\r ")
Exemplo n.º 4
0
def login():
    print("=======================================")
    print("********** Login *******************")
    print("========================================")
    account_from_user = input("Enter your account number: \n >")

    is_valid_account_number = validation.account_number_validation(account_from_user)

    if is_valid_account_number:
        password = input("Enter your password: \n >")
        loading.load()

        user = database.authenticated_user(account_from_user, password)

        if user:
            print("Welcome %s !" % user[1])
            bank_operations(user)
        else:
            print("Wrong account number or password")
            login()
    else:
        init()
Exemplo n.º 5
0
def delete_user(account_number):
    mydb = mysql.connector.connect(host="localhost",
                                   user="******",
                                   password="******",
                                   database=database)
    mycursor = mydb.cursor()
    confirm_delete = input(
        "Are you sure you want to delete your account? 1 (Yes) 2 (No) \n >")
    if confirm_delete == 1:
        sql = "DELETE FROM users WHERE account_number = %s"
        print("Account Deleted!")
        loading.load()
        print("Thank you for banking with us!")
        loading.load()
        print("Bye!")
        exit(1)
    elif confirm_delete == 2:
        print("Alright!")
        main2.bank_operations()
    else:
        print("Wrong input! \n Please try again")
        delete_user(account_number)
Exemplo n.º 6
0
def login():
    print("=======================================")
    print("********** Login *******************")
    print("========================================")

    account_from_user = int(input("Enter your account number: \n >"))

    is_valid_account_number = sql.locate_account(account_from_user)

    if is_valid_account_number:
        password = getpass("Enter your password: \n >")
        loading.load()

        user = sql.locate_account_password(account_from_user, password)

        if user:
            print(f"Welcome %s !" % sql.user_name(account_from_user))
            bank_operations(account_from_user)
        else:
            print("Wrong account number or password")
            login()
    else:
        init()
Exemplo n.º 7
0
import sprite2

if not __name__ == "__main__":
    sys.exit(0)

pygame.init()

gameScreen = pygame.Surface((SCREENWIDTH, SCREENHEIGHT))
display = pygame.display.set_mode((SCREENWIDTH * SCALEFACTOR, SCREENHEIGHT * SCALEFACTOR))
pygame.display.set_caption("Pygame Project")

clock = pygame.time.Clock()

#####Debug stuff here

scene = loading.load("test_map03")

chest = objects.getObjectsOfType(Chest)[0]
chest._items = [Item("Potion"), Item("Potion"), Item("Book")]

animTile = GameObject(z = 10, position = Vector2(0, 50))
animTile.sprite = sprite2.loadSpriteAnimation("player_idle")
animTile.play("player_idle")

_player = objects.getObjectsOfType(player.Player)[0]
_player.sprite = sprite2.loadSpriteAnimation("eggy")
_player.play("eggy")

#####
camera = Camera(15)
camera.setTarget(player.getPlayer())
Exemplo n.º 8
0
import loading
from tkinter import *
import view
import test
loading.load() # 크롤링



window = Tk()

window.title('English_study')

button_wordview=Button(window, text = "오늘의 단어",font=("consolas",30), bg = "gray",width = 10,height = 2, command=view.wordview)
button_wordview.pack()

button_wordtest=Button(window, text = "단어 테스트",font=("consolas",30), bg = "gray",width = 10,height = 2, command=test.wordtest)
button_wordtest.pack()


window.mainloop()
from pathlib import Path
from loading import load_csv_results as load
from wafer_data_wrangling import wafer_wrangling
from particle_data_wrangling import particle_melting
from dashboard import make_dashboard
import settings

inPath = Path('../results_csv/')
outPath = Path('../figures/')

wafer_results, particle_results, particle_snips = load(inPath)

molten_particles = particle_melting(particle_results)

waffles, wafer_images = wafer_wrangling(wafer_results, molten_particles)

report = settings.reports.GLMparams

if __name__ == '__main__':
    make_dashboard(waffles, molten_particles, particle_snips, wafer_images, outPath)
Exemplo n.º 10
0
    def __init__(self):
        train_local_raw, test_local_raw = loading.load("local", "human", 2000,
                                                       500)
        train_global_raw, test_global_raw = loading.load(
            "global", "human", 1500, 500)
        #train_local, test_local = loading.load("local", "human", 200, 200)
        #train_global, test_global = loading.load("global", "human", 200, 200)
        self.vocab = util.Index()
        self.vocab.index("UNK")
        self.START = START
        self.STOP = STOP

        raw_splits = {
            ("train", "local"): train_local_raw,
            ("train", "global"): train_global_raw,
            ("test", "local"): test_local_raw,
            ("test", "global"): test_global_raw
        }

        templates = defaultdict(list)

        splits = {}
        task_id = 0
        for fold in ("train", "test"):
            for mode in ("local", ):
                data, task_id = self._format_data(fold, raw_splits[fold, mode],
                                                  templates, task_id)
                splits[fold, mode] = data

        final_templates = defaultdict(list)
        for k, vv in templates.items():
            counts = defaultdict(lambda: 0)
            for v in vv:
                counts[v] += 1
            for v, c in counts.items():
                if c > 1:
                    final_templates[k].append(v)
        final_templates = dict(final_templates)

        train_local_fmt = splits["train", "local"]
        test_local_fmt = splits["test", "local"]

        task_counter = 0
        self.train, n_train_tasks = self._build_examples(train_local_fmt,
                                                         5000,
                                                         final_templates,
                                                         task_counter,
                                                         group_tasks=False)
        self.test, n_total_tasks = self._build_examples(test_local_fmt,
                                                        50,
                                                        final_templates,
                                                        n_train_tasks,
                                                        group_tasks=True)
        self.test_ids = sorted(list(set(d.task_id for d in self.test)))

        print "[n_train]", len(self.train)
        print "[n_test]", len(self.test), "test"

        samp = self.sample_train()
        self.n_features = samp.features.size
        self.n_tasks = n_train_tasks
        self.n_actions = ACTS

        print "[task_ids]", n_train_tasks, "->", n_total_tasks
        print "[n_vocab]", len(self.vocab)
Exemplo n.º 11
0
import dash
import dash_core_components as dcc
import dash_bootstrap_components as dbc
import dash_html_components as html
import reading
import drawing
import components
import loading

stats = reading.read_all()
region_stats = reading.read_regions()
stats_slope = reading.read_slope()
loading.load()
chart_1 = drawing.draw_chart_1(stats)
chart_2 = drawing.draw_chart_2(stats)
chart_3 = drawing.draw_chart_3(stats)
chart_4 = drawing.draw_chart_4(stats_slope)

app = dash.Dash(external_stylesheets=[dbc.themes.BOOTSTRAP])
app.title = 'Covid19 data analysis'
app.layout = html.Div(children=[
    html.H1(children='Covid19 data analysis',
            style={
                'textAlign': 'center',
                'margin-top': '2rem'
            }),
    html.H6(children='Stefano leggio', style={
        'textAlign': 'center',
    }),
    dbc.Row(dbc.Col([
        html.H6(children="Dati del " +
Exemplo n.º 12
0
def bank_operations(account_from_user):
    loading.load()
    print("==========================================================")
    print("********** What would you like to do? *******************")
    print("==========================================================")
    print("> 1. Withdraw")
    print("> 2. Deposit")
    print("> 3. Request a Loan")
    print("> 4. Update account profile")
    print("> 5. Exit")
    option = int(input("> "))
    if option == 1:
        loading.load()
        print("Withdraw")
        operations.withdraw(account_from_user)
        bank_operations(account_from_user)
    elif option == 2:
        loading.load()
        print("Deposit")
        operations.deposit(account_from_user)
        bank_operations(account_from_user)
    elif option == 3:
        loading.load()
        print("Request a loan")
        print("Function not available!")
    elif option == 4:
        loading.load()
        print("Account Profile")
        operations.update_profile(account_from_user)
        bank_operations(account_from_user)
    elif option == 5:
        loading.load()
        exit(1)
    else:
        print("Invalid option")
        exit(0)