@@ -360,7 +360,6 @@ class MargaritaBuilder:
360
360
self .pizza = Pizza(' margarita' )
361
361
self .progress = PizzaProgress.queued
362
362
self .baking_time = 5 # in seconds for the sake of the
363
- example
364
363
365
364
def prepare_dough (self ):
366
365
self .progress = PizzaProgress.preparation
@@ -402,53 +401,53 @@ class CreamyBaconBuilder:
402
401
self .pizza = Pizza(' creamy bacon' )
403
402
self .progress = PizzaProgress.queued
404
403
self .baking_time = 7 # in seconds for the sake of the
405
- example
406
404
407
405
def prepare_dough (self ):
408
- self .progress = PizzaProgress.preparation
409
- self .pizza.prepare_dough(PizzaDough.thick)
406
+ self .progress = PizzaProgress.preparation
407
+ self .pizza.prepare_dough(PizzaDough.thick)
410
408
411
409
def add_sauce (self ):
412
- print (' adding the crème fraîche sauce to your creamy bacon' )
413
- self .pizza.sauce = PizzaSauce.creme_fraiche
414
- time.sleep(STEP_DELAY )
415
- print (' done with the crème fraîche sauce' )
410
+ print (' adding the crème fraîche sauce to your creamy bacon' )
411
+ self .pizza.sauce = PizzaSauce.creme_fraiche
412
+ time.sleep(STEP_DELAY )
413
+ print (' done with the crème fraîche sauce' )
416
414
417
415
def add_topping (self ):
418
- print (' adding the topping (mozzarella, bacon, ham, mushrooms, red onion, oregano) to your creamy bacon' )
419
- self .pizza.topping.append([t for t in
420
- (PizzaTopping.mozzarella, PizzaTopping.bacon,
421
- PizzaTopping.ham,PizzaTopping.mushrooms,
422
- PizzaTopping.red_onion, PizzaTopping.oregano)])
423
- time.sleep(STEP_DELAY )
424
- print (' done with the topping (mozzarella, bacon, ham, mushrooms, red onion, oregano)' )
416
+ print (' adding the topping (mozzarella, bacon, ham, mushrooms, red onion, oregano) to your creamy bacon' )
417
+ self .pizza.topping.append([t for t in
418
+ (PizzaTopping.mozzarella, PizzaTopping.bacon,
419
+ PizzaTopping.ham,PizzaTopping.mushrooms,
420
+ PizzaTopping.red_onion, PizzaTopping.oregano)])
421
+ time.sleep(STEP_DELAY )
422
+ print (' done with the topping (mozzarella, bacon, ham, mushrooms, red onion, oregano)' )
425
423
426
424
def bake (self ):
427
- self .progress = PizzaProgress.baking
428
- print (' baking your creamy bacon for {} seconds' .format(self .baking_time))
429
- time.sleep(self .baking_time)
430
- self .progress = PizzaProgress.ready
431
- print (' your creamy bacon is ready' )
425
+ self .progress = PizzaProgress.baking
426
+ print (' baking your creamy bacon for {} seconds' .format(self .baking_time))
427
+ time.sleep(self .baking_time)
428
+ self .progress = PizzaProgress.ready
429
+ print (' your creamy bacon is ready' )
432
430
433
431
434
- class Waiter :
435
- def __init__ (self ):
436
- self .builder = None
437
- def construct_pizza (self , builder ):
438
- self .builder = builder
439
- [step() for step in (builder.prepare_dough,
440
- builder.add_sauce, builder.add_topping, builder.bake)]
441
- @ property
442
- def pizza (self ):
443
- return self .builder.pizza
444
-
445
- def validate_style (builders ):
446
- try :
447
- pizza_style = input (' What pizza would you like, [m]argarita or [c]reamy bacon? ' )uilder = builders[pizza_style]() valid_input = True
448
- except KeyError as err:
449
- print (' Sorry, only margarita (key m) and creamy bacon (key c) are available' )
450
- return (False , None )
451
- return (True , builder)
432
+ class Waiter :
433
+ def __init__ (self ):
434
+ self .builder = None
435
+ def construct_pizza (self , builder ):
436
+ self .builder = builder
437
+ [step() for step in (builder.prepare_dough,
438
+ builder.add_sauce, builder.add_topping, builder.bake)]
439
+ @ property
440
+ def pizza (self ):
441
+ return self .builder.pizza
442
+ def validate_style (builders ):
443
+ try :
444
+ pizza_style = input (' What pizza would you like,[m]argarita or [c]reamy bacon? ' )
445
+ builder = builders[pizza_style]()
446
+ valid_input = True
447
+ except KeyError as err:
448
+ print (' Sorry, only margarita (key m) and creamy bacon (key c) are available' )
449
+ return (False , None )
450
+ return (True , builder)
452
451
453
452
454
453
def main ():
0 commit comments