Пример #1
0
 def get_context_data(self, **kwargs):
     context = super().get_context_data(**kwargs)
     context['services'] = Service().List_Service(
         self.request.user.username)
     context['number'] = Service().Number_Service(
         self.request.user.username)
     return context
 def on_submit(self):
     matrix = self.table.get_matrix()
     architecture = Architecture_matrix(matrix, self.frows, self.fcolumns)
     service = Service(architecture)
     service.show_road_point()
     service.represent_roads()
     self.draw(matrix)
Пример #3
0
 def test_most_rented_books(self):
     self.bookS = BookService()
     self.clientS = ClientService()
     self.rentalS = RentalService()
     self._service = Service(self.bookS, self.clientS, self.rentalS)
     self.assertEqual(self._service.most_rented_books()[0],
                      ['Dear John', 3])
 def Step_Three(self, file_name_in):
     pair = matrix_read(file_name_in)
     matrix = pair[0]
     rows = pair[1]
     columns = pair[2]
     architecture = Architecture_matrix(matrix, rows, columns)
     service = Service(architecture)
     service.represent_points()
     self.show_matrix(matrix)
 def Step_One(self, file_name_in, file_name_out):
     pair = matrix_read(file_name_in)
     matrix = pair[0]
     rows = pair[1]
     columns = pair[2]
     architecture = Architecture_matrix(matrix, rows, columns)
     service = Service(architecture)
     service.show_road_point()
     service.represent_roads()
     matrix_write(file_name_out, matrix, rows)
     self.show_matrix(matrix)
Пример #6
0
 def test_redo(self):
     self.bookS = BookService()
     self.clientS = ClientService()
     self.rentalS = RentalService()
     self.undo_list = []
     self.redo_list = []
     self._service = Service(self.bookS, self.clientS, self.rentalS)
     book = self.bookS.add('121', 'Nope', 'John')
     self._service.append_for_undo([self.bookS.add, book])
     self._service.undo()
     self._service.redo()
Пример #7
0
 def test_functions_undo_redo(self):
     self.bookS = BookService()
     self.clientS = ClientService()
     self.rentalS = RentalService()
     self.undo_list = []
     self.redo_list = []
     self._service = Service(self.bookS, self.clientS, self.rentalS)
     book = Book('121', 'Nope', 'John')
     client = Client('223', 'Poppy')
     self._service.book_add(book)
     self.assertEqual(len(self.bookS.display()), 11)
     self._service.book_remove(book)
     self.assertEqual(len(self.bookS.display()), 10)
     self._service.client_add(client)
     self.assertEqual(len(self.clientS.display()), 11)
     self._service.client_remove(client)
     self.assertEqual(len(self.clientS.display()), 10)
     rental = Rental('212', '121', '223', ['14', '1', '2018'],
                     ['29', '5', '2019'])
     rentals = [
         Rental('212', '121', '223', ['14', '1', '2018'],
                ['29', '5', '2019']),
         Rental('002', '121', '223', ['18', '3', '2014'],
                ['29', '7', '2019'])
     ]
     self._service.rental_add(rental)
     self.assertEqual(len(self.rentalS.display()), 11)
     self._service.rental_remove(rental)
     self.assertEqual(len(self.rentalS.display()), 10)
     self._service.add_books_rentals(book, rentals)
     self.assertEqual(len(self.bookS.display()), 11)
     self.assertEqual(len(self.rentalS.display()), 12)
     self._service.remove_books_rentals(book, rentals)
     self.assertEqual(len(self.bookS.display()), 10)
     self.assertEqual(len(self.rentalS.display()), 10)
     self._service.add_client_rentals(client, rentals)
     self.assertEqual(len(self.clientS.display()), 11)
     self.assertEqual(len(self.rentalS.display()), 12)
     self._service.remove_client_rentals(client, rentals)
     self.assertEqual(len(self.clientS.display()), 10)
     self.assertEqual(len(self.rentalS.display()), 10)
     b1 = ['121', 'Nope', 'John']
     c1 = ['223', 'Poppy']
     b = ['121', 'Mommy', 'Lilly']
     c = ['223', 'Mark']
     self.assertEqual(self._service.book_update_undo(b1, b), b)
     self.assertEqual(self._service.book_update_redo(b1, b), b1)
     self.assertEqual(self._service.client_update_undo(c1, c), c)
     self.assertEqual(self._service.client_update_redo(c1, c), c1)
Пример #8
0
def main():
    easy = [
        "input/50p_easy_01_tsp.txt", "input/50p_hard_01_tsp.txt",
        "input/50p_medium_01_tsp.txt"
    ]
    medium = "input/100p_fricker26.txt"
    hard = "input/150p_eil51.txt"

    files = [
        "input/easy_01_tsp.txt", "input/medium_01_tsp.txt",
        "input/hard_01_tsp.txt"
    ]

    serv = Service(files[1])
    serv.solve()
Пример #9
0
 def get(self, request, *args, **kwargs):
     Service().Delete_Service(name=self.kwargs.get('name'),
                              namespace=self.request.user.username)
     return redirect("/service")
Пример #10
0
 def form_valid(self, form):
     Service().Create_Service(name=form.cleaned_data['name'],
                              namespace=self.request.user.username,
                              port=Service().Max_Port() + 1)
     return super().form_valid(form)
from Repository.Repository import Repository
from Service.Service import Service
from UserInterface.UserInterface import UserInterface

repo = Repository(
    "D:\A-FACULTATE\Anu 2\Sem2\Inteligenta Artificiala\Laborator4\in.txt")
service = Service(repo)
ui = UserInterface(service)
ui.run()
Пример #12
0
 def setUp(self):
     self.repo = Repo()
     self.service = Service(self.repo)
     self.board = self.service.create_board(6, 7)
Пример #13
0
 def __init__(self, bookS, clientS, rentalS):
     self._BookService = bookS
     self._ClientService = clientS
     self._RentalService = rentalS
     self._Service = Service(bookS, clientS, rentalS)
Пример #14
0
from UI.App import UI
from Service.Service import Service

service = Service()
ui = UI(service)
ui.run_app()
Пример #15
0
 def test_most_rented_author(self):
     self.bookS = BookService()
     self.clientS = ClientService()
     self.rentalS = RentalService()
     self._service = Service(self.bookS, self.clientS, self.rentalS)
     self.assertEqual(self._service.most_rented_author()[0], ['Spark', 3])
Пример #16
0
 def test_most_active_clients(self):
     self.bookS = BookService()
     self.clientS = ClientService()
     self.rentalS = RentalService()
     self._service = Service(self.bookS, self.clientS, self.rentalS)
     self.assertEqual(self._service.most_active_clients()[0], ['Donna', 3])