Skip to content

Fix flake8 #273

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jan 25, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ script:
- pytest -s -vv --cov=. --log-level=INFO tests/
# Actually run all the scripts, contributing to coverage
- PYTHONPATH=. ./run_all.sh
- flake8 *py
- flake8 patterns/

after_success:
- codecov
2 changes: 1 addition & 1 deletion append_output.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ echo "$src" > $1
echo -e "\n" >> $1
echo "$output_marker" >> $1
echo "$output" >> $1
echo '"""' >> $1
echo '""" # noqa' >> $1
3 changes: 2 additions & 1 deletion patterns/behavioral/command.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
Encapsulates all information needed to perform an action or trigger an event.

*Examples in Python ecosystem:
Django HttpRequest (without `execute` method): https://docs.djangoproject.com/en/2.1/ref/request-response/#httprequest-objects
Django HttpRequest (without `execute` method):
https://docs.djangoproject.com/en/2.1/ref/request-response/#httprequest-objects
"""

from __future__ import print_function
Expand Down
8 changes: 2 additions & 6 deletions patterns/behavioral/iterator.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,9 @@ def main():
for number in count_to_two():
print(number, end=' ')

print()

print('Counting to five...')
print('\nCounting to five...')
for number in count_to_five():
print(number, end=' ')

print()


if __name__ == "__main__":
Expand All @@ -47,4 +43,4 @@ def main():
one two
Counting to five...
one two three four five
"""
""" # noqa
7 changes: 4 additions & 3 deletions patterns/behavioral/memento.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,25 +98,26 @@ def main():
print(num_obj)
num_obj.value += 'x' # will fail
print(num_obj)
except Exception as e:
except Exception:
a_transaction.rollback()
print('-- rolled back')
print(num_obj)

print('-- now doing stuff ...')
try:
num_obj.do_stuff()
except Exception as e:
except Exception:
print('-> doing stuff failed!')
import sys
import traceback

traceback.print_exc(file=sys.stdout)
print(num_obj)


if __name__ == '__main__':
main()


OUTPUT = """
<NumObj: -1>
Expand Down
2 changes: 1 addition & 1 deletion patterns/behavioral/specification.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ def main():
print(root_specification.is_satisfied_by(ivan))
print(root_specification.is_satisfied_by(vasiliy))


if __name__ == '__main__':
main()

Expand Down
2 changes: 1 addition & 1 deletion patterns/behavioral/state.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ def main():
for action in actions:
action()


if __name__ == '__main__':
main()

Expand Down
2 changes: 1 addition & 1 deletion patterns/behavioral/template.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
An example of the Template pattern in Python

*TL;DR80
Defines the skeleton of a base algorithm, deferring definition of exact
Defines the skeleton of a base algorithm, deferring definition of exact
steps to subclasses.

*Examples in Python ecosystem:
Expand Down
2 changes: 1 addition & 1 deletion patterns/fundamental/delegation_pattern.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def __init__(self, delegate):

def __getattr__(self, name):
attr = getattr(self.delegate, name)

if not callable(attr):
return attr

Expand Down
4 changes: 2 additions & 2 deletions patterns/structural/flyweight.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,8 @@ def __init__(self, *args, **kwargs):
cm2 = Card2('10', 'h', a=1)
cm3 = Card2('10', 'h', a=2)

assert (cm1 == cm2) and ( cm1 != cm3)
assert (cm1 is cm2) and ( cm1 is not cm3)
assert (cm1 == cm2) and (cm1 != cm3)
assert (cm1 is cm2) and (cm1 is not cm3)
assert len(instances_pool) == 2

del cm1
Expand Down
5 changes: 5 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,8 @@
max-line-length = 120
ignore = E266 E731
exclude = .venv*

[tool:pytest]
filterwarnings =
; ignore TestRunner class from facade example
ignore:.*test class 'TestRunner'.*:Warning
3 changes: 1 addition & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@
"Programming Language :: Python :: 2",
"Programming Language :: Python :: 2.7",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.4",
"Programming Language :: Python :: 3.5",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
],
)