Skip to Content
Clean Code in Python
book

Clean Code in Python

by Mariano Anaya
August 2018
Intermediate to advanced
332 pages
9h 12m
English
Packt Publishing
Content preview from Clean Code in Python

Calling from the application

Here is how these objects are going to be used in the application. Notice how this depends on the previous packages (web and storage), but not the other way round:

from storage import DBClient, DeliveryStatusQuery, OrderNotFoundErrorfrom web import NotFound, View, app, register_routeclass DeliveryView(View):    async def _get(self, request, delivery_id: int):        dsq = DeliveryStatusQuery(int(delivery_id), await DBClient())        try            result = await dsq.get()        except OrderNotFoundError as e:             raise NotFound(str(e)) from e        return result.message()register_route(DeliveryView, "/status/<delivery_id:int>")

In the previous section, the domain objects were shown and here the code for the application is displayed. Aren't we missing something? ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Clean Code in Python - Second Edition

Clean Code in Python - Second Edition

Mariano Anaya
Python for Programmers

Python for Programmers

Paul Deitel, Harvey Deitel

Publisher Resources

ISBN: 9781788835831Supplemental Content