Skip to content

Commit 6f12a4c

Browse files
authored
Merge pull request faif#273 from gyermolenko/fix_flake8
Fix flake8
2 parents 8099882 + 0731056 commit 6f12a4c

File tree

12 files changed

+22
-20
lines changed

12 files changed

+22
-20
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ script:
2020
- pytest -s -vv --cov=. --log-level=INFO tests/
2121
# Actually run all the scripts, contributing to coverage
2222
- PYTHONPATH=. ./run_all.sh
23-
- flake8 *py
23+
- flake8 patterns/
2424

2525
after_success:
2626
- codecov

append_output.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,4 @@ echo "$src" > $1
1616
echo -e "\n" >> $1
1717
echo "$output_marker" >> $1
1818
echo "$output" >> $1
19-
echo '"""' >> $1
19+
echo '""" # noqa' >> $1

patterns/behavioral/command.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
Encapsulates all information needed to perform an action or trigger an event.
77
88
*Examples in Python ecosystem:
9-
Django HttpRequest (without `execute` method): https://docs.djangoproject.com/en/2.1/ref/request-response/#httprequest-objects
9+
Django HttpRequest (without `execute` method):
10+
https://docs.djangoproject.com/en/2.1/ref/request-response/#httprequest-objects
1011
"""
1112

1213
from __future__ import print_function

patterns/behavioral/iterator.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,9 @@ def main():
2929
for number in count_to_two():
3030
print(number, end=' ')
3131

32-
print()
33-
34-
print('Counting to five...')
32+
print('\nCounting to five...')
3533
for number in count_to_five():
3634
print(number, end=' ')
37-
38-
print()
3935

4036

4137
if __name__ == "__main__":
@@ -47,4 +43,4 @@ def main():
4743
one two
4844
Counting to five...
4945
one two three four five
50-
"""
46+
""" # noqa

patterns/behavioral/memento.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -98,25 +98,26 @@ def main():
9898
print(num_obj)
9999
num_obj.value += 'x' # will fail
100100
print(num_obj)
101-
except Exception as e:
101+
except Exception:
102102
a_transaction.rollback()
103103
print('-- rolled back')
104104
print(num_obj)
105105

106106
print('-- now doing stuff ...')
107107
try:
108108
num_obj.do_stuff()
109-
except Exception as e:
109+
except Exception:
110110
print('-> doing stuff failed!')
111111
import sys
112112
import traceback
113113

114114
traceback.print_exc(file=sys.stdout)
115115
print(num_obj)
116116

117+
117118
if __name__ == '__main__':
118119
main()
119-
120+
120121

121122
OUTPUT = """
122123
<NumObj: -1>

patterns/behavioral/specification.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ def main():
102102
print(root_specification.is_satisfied_by(ivan))
103103
print(root_specification.is_satisfied_by(vasiliy))
104104

105-
105+
106106
if __name__ == '__main__':
107107
main()
108108

patterns/behavioral/state.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ def main():
7676
for action in actions:
7777
action()
7878

79-
79+
8080
if __name__ == '__main__':
8181
main()
8282

patterns/behavioral/template.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
An example of the Template pattern in Python
66
77
*TL;DR80
8-
Defines the skeleton of a base algorithm, deferring definition of exact
8+
Defines the skeleton of a base algorithm, deferring definition of exact
99
steps to subclasses.
1010
1111
*Examples in Python ecosystem:

patterns/fundamental/delegation_pattern.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ def __init__(self, delegate):
3232

3333
def __getattr__(self, name):
3434
attr = getattr(self.delegate, name)
35-
35+
3636
if not callable(attr):
3737
return attr
3838

patterns/structural/flyweight.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,8 +119,8 @@ def __init__(self, *args, **kwargs):
119119
cm2 = Card2('10', 'h', a=1)
120120
cm3 = Card2('10', 'h', a=2)
121121

122-
assert (cm1 == cm2) and ( cm1 != cm3)
123-
assert (cm1 is cm2) and ( cm1 is not cm3)
122+
assert (cm1 == cm2) and (cm1 != cm3)
123+
assert (cm1 is cm2) and (cm1 is not cm3)
124124
assert len(instances_pool) == 2
125125

126126
del cm1

setup.cfg

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,8 @@
22
max-line-length = 120
33
ignore = E266 E731
44
exclude = .venv*
5+
6+
[tool:pytest]
7+
filterwarnings =
8+
; ignore TestRunner class from facade example
9+
ignore:.*test class 'TestRunner'.*:Warning

setup.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,7 @@
77
"Programming Language :: Python :: 2",
88
"Programming Language :: Python :: 2.7",
99
"Programming Language :: Python :: 3",
10-
"Programming Language :: Python :: 3.4",
11-
"Programming Language :: Python :: 3.5",
1210
"Programming Language :: Python :: 3.6",
11+
"Programming Language :: Python :: 3.7",
1312
],
1413
)

0 commit comments

Comments
 (0)