Skip to content

Commit 27a2110

Browse files
author
Arie Bregman
committed
Fix PEP8 issues
* E305 expected 2 blank lines after class or function definition * E501 line too long (87 > 79 characters) * W391 blank line at end of file
1 parent 3b609e0 commit 27a2110

File tree

8 files changed

+30
-10
lines changed

8 files changed

+30
-10
lines changed

behavioral/catalog.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,7 @@ def main():
168168
test.main_method()
169169

170170
if __name__ == "__main__":
171+
171172
main()
172173

173174
### OUTPUT ###

dft/constructor_injection.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ def get_current_time_as_html_fragment(self):
2020
return current_time_as_html_fragment
2121
"""
2222

23+
2324
class TimeDisplay(object):
2425

2526
def __init__(self, time_provider):
@@ -30,6 +31,7 @@ def get_current_time_as_html_fragment(self):
3031
current_time_as_html_fragment = "<span class=\"tinyBoldText\">{}</span>".format(current_time)
3132
return current_time_as_html_fragment
3233

34+
3335
class ProductionCodeTimeProvider(object):
3436
"""
3537
Production code version of the time provider (just a wrapper for formatting
@@ -38,9 +40,11 @@ class ProductionCodeTimeProvider(object):
3840

3941
def now(self):
4042
current_time = datetime.datetime.now()
41-
current_time_formatted = "{}:{}".format(current_time.hour, current_time.minute)
43+
current_time_formatted = "{}:{}".format(current_time.hour,
44+
current_time.minute)
4245
return current_time_formatted
4346

47+
4448
class MidnightTimeProvider(object):
4549
"""
4650
Class implemented as hard-coded stub (in contrast to configurable stub).

dft/setter_injection.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ def get_current_time_as_html_fragment(self):
2121
return current_time_as_html_fragment
2222
"""
2323

24+
2425
class TimeDisplay(object):
2526

2627
def __init__(self):
@@ -34,6 +35,7 @@ def get_current_time_as_html_fragment(self):
3435
current_time_as_html_fragment = "<span class=\"tinyBoldText\">{}</span>".format(current_time)
3536
return current_time_as_html_fragment
3637

38+
3739
class ProductionCodeTimeProvider(object):
3840
"""
3941
Production code version of the time provider (just a wrapper for formatting
@@ -42,9 +44,11 @@ class ProductionCodeTimeProvider(object):
4244

4345
def now(self):
4446
current_time = datetime.datetime.now()
45-
current_time_formatted = "{}:{}".format(current_time.hour, current_time.minute)
47+
current_time_formatted = "{}:{}".format(current_time.hour,
48+
current_time.minute)
4649
return current_time_formatted
4750

51+
4852
class MidnightTimeProvider(object):
4953
"""
5054
Class implemented as hard-coded stub (in contrast to configurable stub).

structural/adapter.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66

77
class Dog(object):
8+
89
def __init__(self):
910
self.name = "Dog"
1011

@@ -13,6 +14,7 @@ def bark(self):
1314

1415

1516
class Cat(object):
17+
1618
def __init__(self):
1719
self.name = "Cat"
1820

@@ -21,6 +23,7 @@ def meow(self):
2123

2224

2325
class Human(object):
26+
2427
def __init__(self):
2528
self.name = "Human"
2629

@@ -29,6 +32,7 @@ def speak(self):
2932

3033

3134
class Car(object):
35+
3236
def __init__(self):
3337
self.name = "Car"
3438

@@ -74,12 +78,13 @@ def __init__(self, obj, **adapted_methods):
7478
def __getattr__(self, attr):
7579
"""All non-adapted calls are passed to the object"""
7680
return getattr(self.obj, attr)
77-
81+
7882
def original_dict(self):
7983
"""Print original object dict"""
8084
return self.obj.__dict__
8185

8286
def main():
87+
8388
objects = []
8489
dog = Dog()
8590
print(dog.__dict__)

structural/front_controller.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,19 @@
99

1010

1111
class MobileView(object):
12+
1213
def show_index_page(self):
1314
print('Displaying mobile index page')
1415

1516

1617
class TabletView(object):
18+
1719
def show_index_page(self):
1820
print('Displaying tablet index page')
1921

2022

2123
class Dispatcher(object):
24+
2225
def __init__(self):
2326
self.mobile_view = MobileView()
2427
self.tablet_view = TabletView()
@@ -34,6 +37,7 @@ def dispatch(self, request):
3437

3538
class RequestController(object):
3639
""" front controller """
40+
3741
def __init__(self):
3842
self.dispatcher = Dispatcher()
3943

@@ -72,4 +76,4 @@ def __init__(self, request):
7276
# Displaying mobile index page
7377
# Displaying tablet index page
7478
# cant dispatch the request
75-
# request must be a Request object
79+
# request must be a Request object

tests/test_decorator.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,3 @@ def test_mixed_bold_and_italic(self):
2121
self.assertEqual(
2222
BoldWrapper(ItalicWrapper(self.raw_string)).render(),
2323
'<b><i>raw but not cruel</i></b>')
24-

tests/test_hsm.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,14 @@ def test_given_standby_on_message_switchover_shall_set_active(cls):
5757
cls.assertEqual(isinstance(cls.hsm._current_state, Active), True)
5858

5959
def test_given_standby_on_message_switchover_shall_call_hsm_methods(cls):
60-
with patch.object(cls.hsm, '_perform_switchover') as mock_perform_switchover,\
61-
patch.object(cls.hsm, '_check_mate_status') as mock_check_mate_status,\
62-
patch.object(cls.hsm, '_send_switchover_response') as mock_send_switchover_response,\
63-
patch.object(cls.hsm, '_next_state') as mock_next_state:
60+
with patch.object(cls.hsm,
61+
'_perform_switchover') as mock_perform_switchover,\
62+
patch.object(cls.hsm,
63+
'_check_mate_status') as mock_check_mate_status,\
64+
patch.object(cls.hsm,
65+
'_send_switchover_response') as mock_send_switchover_response,\
66+
patch.object(cls.hsm,
67+
'_next_state') as mock_next_state:
6468
cls.hsm.on_message('switchover')
6569
cls.assertEqual(mock_perform_switchover.call_count, 1)
6670
cls.assertEqual(mock_check_mate_status.call_count, 1)

tests/test_prototype.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,4 +49,3 @@ def test_particular_properties_retrieving(self):
4949
def test_extended_properties_retrieving(self):
5050
self.assertEqual(self.dispatcher.get_objects()['A'].ext_value, 'E')
5151
self.assertTrue(self.dispatcher.get_objects()['B'].diff)
52-

0 commit comments

Comments
 (0)