File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11language : python
22python :
3- - " 3.7.5 "
3+ - " 3.8.3 "
44# command to install dependencies
55install :
66 - make deps
Original file line number Diff line number Diff line change 11.PHONY : deps clean tests
22
33ENV =.env
4- PYTHON =python3.7
4+ PYTHON =python3.8
55PYTHON_VERSION =$(shell ${PYTHON} -V | cut -d " " -f 2 | cut -c1-3)
66SITE_PACKAGES =${ENV}/lib/python${PYTHON_VERSION}/site-packages
77IN_ENV =source ${ENV}/bin/activate;
Original file line number Diff line number Diff line change 11# clean-code-python
22
33[ ![ Build Status] ( https://travis-ci.com/zedr/clean-code-python.svg?branch=master )] ( https://travis-ci.com/zedr/clean-code-python )
4- [ ![ ] ( https://img.shields.io/badge/python-3.7 +-blue.svg )] ( https://www.python.org/download/releases/3.7.5 / )
4+ [ ![ ] ( https://img.shields.io/badge/python-3.8 +-blue.svg )] ( https://www.python.org/download/releases/3.8.3 / )
55
66## Table of Contents
77 1 . [ Introduction] ( #introduction )
@@ -366,6 +366,36 @@ create_menu(
366366)
367367```
368368
369+ ** Even fancier, Python3.8+ only**
370+ ``` python
371+ class MenuConfig (typing .TypedDict ):
372+ """ A configuration for the Menu.
373+
374+ Attributes:
375+ title: The title of the Menu.
376+ body: The body of the Menu.
377+ button_text: The text for the button label.
378+ cancellable: Can it be cancelled?
379+ """
380+ title: str
381+ body: str
382+ button_text: str
383+ cancellable: bool = False
384+
385+
386+ def create_menu (config : MenuConfig):
387+ title = config[" title" ]
388+ # ...
389+
390+
391+ create_menu(
392+ {
393+ ' title' : " My delicious menu" ,
394+ ' body' : " A description of the various items on the menu" ,
395+ ' button_text' : " Order now!"
396+ }
397+ )
398+ ```
369399** [ ⬆ back to top] ( #table-of-contents ) **
370400
371401### Functions should do one thing
You can’t perform that action at this time.
0 commit comments