Skip to content

Commit 52963ac

Browse files
committed
PEP8 corrections
1 parent 755086b commit 52963ac

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

structural/mvc.py

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
#!/usr/bin/env python
22
# -*- coding: utf-8 -*-
33

4+
45
class Model(object):
6+
57
def __iter__(self):
68
raise NotImplementedError
79

@@ -15,20 +17,21 @@ def item_type(self):
1517
raise NotImplementedError
1618

1719

18-
1920
class ProductModel(Model):
2021

2122
class Price(float):
22-
"""A polymorphic way to pass a float with a particular __str__ functionality."""
23+
"""A polymorphic way to pass a float with a particular
24+
__str__ functionality."""
25+
2326
def __str__(self):
24-
first_digits_str = str(round(self,2))
27+
first_digits_str = str(round(self, 2))
2528
try:
2629
dot_location = first_digits_str.index('.')
2730
except ValueError:
2831
return (first_digits_str + '.00')
2932
else:
3033
return (first_digits_str +
31-
'0'*(3 + dot_location - len(first_digits_str)))
34+
'0' * (3 + dot_location - len(first_digits_str)))
3235

3336
products = {
3437
'milk': {'price': Price(1.50), 'quantity': 10},
@@ -48,7 +51,9 @@ def get(self, product):
4851
except KeyError as e:
4952
raise KeyError((str(e) + " not in the model's item list."))
5053

54+
5155
class View(object):
56+
5257
def show_item_list(self, item_type, item_list):
5358
raise NotImplementedError
5459

@@ -60,6 +65,7 @@ def show_item_information(self, item_type, item_name, item_info):
6065
def item_not_found(self, item_type, item_name):
6166
raise NotImplementedError
6267

68+
6369
class ConsoleView(View):
6470

6571
def show_item_list(self, item_type, item_list):
@@ -81,7 +87,8 @@ def show_item_information(self, item_type, item_name, item_info):
8187
print(printout)
8288

8389
def item_not_found(self, item_type, item_name):
84-
print('That %s "%s" does not exist in the records' % (item_type, item_name))
90+
print('That %s "%s" does not exist in the records' %
91+
(item_type, item_name))
8592

8693

8794
class Controller(object):

0 commit comments

Comments
 (0)