Ejemplo n.º 1
0
    def CreateElement():
        companies = pd.read_csv('../Data/Companies.csv',
                                encoding='latin1',
                                index_col='Unnamed: 0')
        collaborations = pd.read_csv('../Data/Collaboration_Id.csv',
                                     encoding='latin1',
                                     index_col='Unnamed: 0')
        products = pd.read_csv('../Data/Products.csv',
                               encoding='latin1',
                               index_col='Unnamed: 0')

        notebooks = ft.df_to_dict(companies, collaborations, products)

        ParametresLst = []

        ParametresLst.extend([
            CompanyEntry.get(),
            ProductEntry.get(),
            TypeNameEntry.get(),
            InchesEntry.get(),
            ScreenResolutionEntry.get(),
            CpuEntry.get(),
            RamEntry.get(),
            MemoryEntry.get(),
            GpuEntry.get(),
            OpSysEntry.get(),
            WeightEntry.get(),
            PriceEurosEntry.get()
        ])
        ft.create(companies, collaborations, products, notebooks,
                  ft.list_to_dct(ParametresLst))
Ejemplo n.º 2
0
    def test_create(self, obj):
        a = Mock()
        a.rpush.return_value = []

        obj.return_value = a

        self.assertIsNone(create('', '', ''))
Ejemplo n.º 3
0
def server_post():
    action = request.forms.get('action')

    if action == "CREATE":
        student = request.forms.get('student')
        subjects = request.forms.get('subjects')
        rates = request.forms.get('rates')
        create(student, subjects, rates)

    elif action == "UPDATE":
        student= request.forms.get('student')
        prev_subject = request.forms.get('prev_subject')
        prev_mark = request.forms.get('prev_mark')
        new_student = request.forms.get('new_student')
        new_subject = request.forms.get('new_subject')
        new_mark = request.forms.get('new_mark')
        update(student, prev_subject, prev_mark, new_student, new_subject, new_mark)

    elif action == "DELETE":
        student = request.forms.get('student')
        subject = request.forms.get('subject')
        mark = request.forms.get('mark')
        delete(student, subject, mark)
Ejemplo n.º 4
0
    operation = int(input())

    if operation == 1:
        print("Enter the Key : ")
        key = input()
        print("Enter the value : ")
        value = input()
        print("Do you wish for the key to have time-to-live : [y/n]")
        cond = input()

        # asking whether user wants to provide the key with time-to-live property or not
        if cond == 'y':
            print(
                "Enter how long should the key be active (time in seconds) : ")
            time = int(input())
            functions.create(key, value, time)
        else:
            functions.create(key, value)
        functions.save()

    elif operation == 2:
        print("Enter the Key to read the value : ")
        key = input()
        print(functions.read(key))
        functions.save()

    elif operation == 3:
        print("Enter the Key to be deleted : ")
        key = input()
        functions.delete(key)
        functions.save()
Ejemplo n.º 5
0
    print("\033[1;33mOlá! Bem-vindo ao Header!\033[0;0m")
    print("\033[1;32mStatus do Header: iniciado\033[0;0m" if status ==
          True else "\033[1;31mStatus do Header: não iniciado\033[0;0m")
    print("\033[1;32mPara obter ajuda no uso da ferramenta, digite:\033[0;0m")
    print("python3 header.py help")
else:
    arg.pop(0)

if status and arg[0].lower() == "w":
    print(functions.write(arg))
elif status and arg[0].lower() == "ws":
    print(functions.write_save(arg, directory))
elif status and arg[0].lower() == "s":
    print(functions.save(arg, directory))
elif status and arg[0].lower() == "c":
    print(functions.create(arg, directory))
elif not status and arg[0].lower() == "init":
    print(functions.init(directory))
elif status and arg[0].lower() == "init":
    print("Seu Header já foi iniciado!")
elif status and arg[0].lower() == "list":
    functions.list_ws(directory)
elif status and arg[0].lower() == "e":
    print(functions.edit(arg, directory))
elif status and arg[0].lower() == "d":
    print(functions.delete(arg, directory))
elif arg[0].lower() == "help":
    help("header")

config.close()
Ejemplo n.º 6
0
from functions import create, remove, menu, show
menu()
n = int(input("Uildliin dugaar oruulna uu: "))
if n == 1:
    show()
elif n == 2:
    create()
elif n == 3:
    remove()
elif n == 4:
    print("homework")
else:
    print("Ta programmaas garlaa")
Ejemplo n.º 7
0
#MODULE IMPORT
import functions

#MAIN MENU
i = 1
menuopts = [1, 2, 3, 4, 5]
while i == 1:
    print("1: Create an account")
    print("2: Login")
    print("3: Forgot Password")
    print("4: Quit Software")
    print("5: User's Info")
    try:
        menuoption = int(input("Which menu option would you like to chose?\n"))
        if menuoption == 1:
            functions.create()
        if menuoption == 2:
            functions.login()
        if menuoption == 3:
            functions.forgotpass()
        if menuoption == 4:
            print("TERMINATING PROGRAM")
            quit()
        if menuoption == 5:
            functions.admintools()
        if menuoption not in menuopts:
            print("That was not an option on the menu! TRY AGAIN!!\n")
    except ValueError:
        print("That was not an option on the menu! TRY AGAIN!\n")
Ejemplo n.º 8
0
from functions import create, organize, remove

if __name__ == '__main__':
    print('Welcome to DeClutter')
    src_path = input('Enter Source Path: ')
    dest_path = os.path.join(src_path,'DeClutter')
    
    print('Destination: ',dest_path)
    print('Enter your desired choice')
    print('1. Run DeClutter')
    print('2. Remove DeClutter')
    choice = int(input('Choice: '))

    if choice == 1:
        print('Running...')
        try:
            assert create(dest_path)
        except:
            pass
        finally:
            organize(src_path,dest_path)
            print('Successful!')
        
    elif choice == 2:
        print("Removing Files...")
        organize(src_path,dest_path)
        remove(src_path,dest_path)
        print('Files removed successfully')
    
    else:
        print('Stopped')
Python 3.7.4 (tags/v3.7.4:e09359112e, Jul  8 2019, 19:29:22) [MSC v.1916 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license()" for more information.
>>> 
=== RESTART: C:/Users/vichu/Desktop/CRD key-value data store/functions.py ===
>>> import functions as object
>>> object.create("meena", 30)
Key value successfully created!
>>> object.create("rahul", 20)
Key value successfully created!
>>> object.create("rahul", 45)
Error: Key already exists in the store
>>> object.create("ram", 11110001111111111111111111111111111111111111111111111111111111111111111111111)
Error: Memory limit exceeded!
>>> object.create("12345", 45)
Error: Invalind key_name!! key_name must contain only alphabets and no special characters or numbers
>>> object.read("meena")
'meena:30'
>>> object.read("ram")
Error: The key does not exist in the store. Please enter a valid key
>>> object.create("raju", 25, 30) # creation with timeout
Key value successfully created!
>>> object.read("raju")
Error: time-to-live of  raju  has expired
>>> object.delete("raju")
error: time-to-live of raju has expired
>>> object.delete("rahul")
Key is successfully deleted from the store
>>> object.read("rahul") # deleted rahul and it will not exist in the store
Error: The key does not exist in the store. Please enter a valid key
>>>