Exemplo n.º 1
0
 def fillFields(self):
     k = 0
     self.items = []
     while (True):
         try:
             courier = Courier(k)
             print(type(courier.name))
             self.items.append(
                 str(courier.name) + " " + str(courier.surename))
             k = k + 1
         except KeyError:
             break
     self.Courier.addItems(self.items)
     dfn = pd.read_csv('data/products.csv', encoding='utf-8')
     del dfn['Unnamed: 0']
     self.items = []
     for i in range(len(dfn)):
         self.items.append(dfn.iloc[i, 0])
     self.Product.addItems(self.items)
     k = 0
     self.items = []
     self.itemsAddress = []
     while (True):
         try:
             client = Client(k)
             self.items.append(
                 str(client.name) + " " + str(client.phone_number))
             self.itemsAddress.append(
                 str(client.street) + " " + str(client.house))
             k = k + 1
         except KeyError:
             break
     self.Client.addItems(self.items)
     self.Address.addItems(self.itemsAddress)
Exemplo n.º 2
0
    def test_remove(self):
        dfn = pd.read_csv('data/clients.csv', encoding='utf-8')
        bef = dfn.shape[0]
        Client(0).removeClient()

        dfn = pd.read_csv('data/clients.csv', encoding='utf-8')
        ath = dfn.shape[0]
        self.assertEqual(bef - 1, ath, "Should False")
Exemplo n.º 3
0
    def client_get_details(self, client_id, email=None):

        self.data['action'] = 'getclientsdetails'
        self.data['clientid'] = client_id
        if email is not None:
            self.data['email'] = email

        data = self.send_call()
        return Client(data=data)
Exemplo n.º 4
0
def get_clients():
    """
    Funcion para obtener los clientes de un csv.
    Lo retorna en una lista.
    """
    clients = []
    csv_data = get_data_from_csv('files/clientes.csv')
    clients_data = csv_data['data']
    for client in clients_data:
        clients.append(Client(*client))
    return clients
Exemplo n.º 5
0
 def changeClient(self):
     self.name = self.textName.toPlainText()
     self.surname = self.textSurname.toPlainText()
     self.patronymic = self.textPatr.toPlainText()
     self.street = self.textStreet.toPlainText()
     self.house = self.textHouse.toPlainText()
     self.phone = self.textNumber.toPlainText()
     Client(self.index).changeData(self.name, self.surname, self.patronymic,
                                   self.street, self.house, self.phone)
     self.setWindowTitle("done")
     self.hide()
Exemplo n.º 6
0
 def test_change(self):
     Client(0).changeData("Дмитрий", "Дуплий", "Олегович", "Пушкниа",
                          "Колотушкина", "69")
     self.assertEqual([
         Client(0).name,
         Client(0).surename,
         Client(0).patronymic,
         Client(0).street,
         Client(0).house,
         Client(0).phone_number
     ], ["Дмитрий", "Дуплий", "Олегович", "Пушкниа", "Колотушкина", "69"],
                      "Should False")
Exemplo n.º 7
0
    def client_get_set(self, limitstart=0, limitnum=25, search=None):

        self.data['action'] = 'getclients'
        self.data['limitnum'] = limitnum
        self.data['limitstart'] = limitstart
        if search is not None:
            self.data['search'] = search

        data = self.send_call()
        clients = data['clients']['client']

        client_list = []
        for client in clients:
            client_list.append(Client(data=client))
        return client_list
Exemplo n.º 8
0
def add_people(queue, quantity):
    """ Enqueue given quantity of clients to a queue

		Parameters
		----------
			queue : Queue
				choice of queue to add clients
			quantity : int
				number of clients to be enqueued

		Returns
		-------
			list 
				a list of consequetive enqueues to given queue
	"""
    return [queue.enqueue(Client()) for _ in range(quantity)]
Exemplo n.º 9
0
def simulate_test():
    """ Simulate behavior of one client

		Returns
		-------
			current_time : int
				How many se

	"""
    #Creating queues, a client, and enqueueing the client
    print('Utworzono kolejki!')
    q1 = Queue(queue_type=1)
    q2 = Queue(queue_type=2)
    q3 = Queue(queue_type=3)
    print('Utworzono klienta!')
    c1 = Client(1)
    print('Dołączam do kolejki')
    q1.enqueue(c1)
    # max time equals 9 hours
    max_time = 9 * 3600

    # time spent on registering
    current_time = c1.register_time

    while current_time < max_time:
        if current_time + c1.selection_time + 1800 > max_time:
            print("I won't manage to play another game, quitting...")
            c1.set_type(3)
            # find best queue
            q3.enqueue(c1)
            # wait for your turn
            current_time += c1.signoff_time
            q3.dequeue()
            break
        selection_time = c1.selection_time
        print("I've chosen a game in {}!".format(manage_time(selection_time)))
        game_time = int(np.random.normal(1800, 900))
        print("I played for {}!".format(manage_time(game_time)))
        current_time += selection_time + game_time
    print("Ending within {}".format(manage_time(current_time)))
    return current_time
Exemplo n.º 10
0
from make_seq import MakeSeq
from make_seq import MakeSeqEx
from clients import Client
from writer import Writer

if __name__ == '__main__':
    client = Client('sqlfiles')
    mse = MakeSeqEx()
    seqlist = mse.make_seq_extend(client.sqllist)
    wt = Writer('output')
    wt.todo(seqlist)
    exit(0)
Exemplo n.º 11
0
 def connect_clients(self):
     self.clients = Client(self.config)
     self.client_index = self.clients.clients_to_server()
     self.clients.get_model(self.model)
     self.clients.load_data()
Exemplo n.º 12
0
 def test_remove_negativ(self):
     dfn = pd.read_csv('data/clients.csv', encoding='utf-8')
     bef = dfn.shape[0] + 1
     Client(bef).removeClient()
Exemplo n.º 13
0
 def delClient(self):
     index = self.tableWidget.row(self.tableWidget.currentItem())
     if index == -1:
         return
     Client(index).removeClient()
     self.fillTableClients()
Exemplo n.º 14
0
from clients import Client
from accounts import Account, SpecialAccount
from banks import Bank

joao = Client('Joao da Silva', '777-1234')
maria = Client('Maria da Silva', '555-4321')
contam = Account(maria, 99)
contaj = Account(joao, 100)
tatu = Bank("Tatú")
tatu.abre_conta(contaj)
tatu.abre_conta(contam)
tatu.lista_contas()
contaJoao = SpecialAccount(joao, 2, 500, 1000)
contaJoao.deposito(1000)
contaJoao.deposito(3000)
contaJoao.deposito(95.15)
contaJoao.saque(1500)
contaJoao.extrato()
Exemplo n.º 15
0
from cat import Cat
from clients import Client

if __name__ == '__main__':

    cat1 = Cat("Барон", "Мальчик", "2")
    cat2 = Cat("Сэм", "Мальчик", "2")

    cat1.printCat()
    cat2.printCat()

    print()
    client_1 = Client("Вася", "Пупкин")
    print(client_1)
    client_1.add_money(30)
    print(client_1.get_account())
    client_1.add_money(30.1)
    client_1.spend_money(10)

    print()
    print(client_1)
    print("Транзакции клиента: ", ", ".join(map(str, client_1.get_transactions())))
Exemplo n.º 16
0
from services.passgen import PassGenerator
from services.repo import FileRepository
from services.passwordcheker import PasswordChecker
from conf.config import Settings 
from clients import Client

pass_service = PassGenerator(Settings.pass_generator_pattern)
file_service = FileRepository(Settings.data_folder)
chek_service = PasswordChecker()

client = Client(file_service,pass_service,chek_service)

client.load()

client.execute()
    threadList = []

    clientList = []
    companyList = []
    agencyList = []

    #Flight Companies

    latam = Company('LATAM')
    ryanair = Company('Ryanair')
    airFrance = Company('AirFrance')
    panAm = Company('PanAm')

    companyList = [latam, ryanair, airFrance, panAm]

    #Travel Agencies
    decolar = Agency(companyList, 'Decolar.Com')
    skyScanner = Agency(companyList, 'Sky Scanner')

    agencyList = [decolar, skyScanner]

    for agency in agencyList:
        agency.run()

    sleep(2)

    # Creating Clients
    for i in range(10):
        clientList.append(Client(agencyList))
        threadList.append(Thread(target=clientList[i].run).start())