From 1bff4a0b0ea8a6565dff0dec1e0021c589c66e3a Mon Sep 17 00:00:00 2001 From: Charles-Axel Dein Date: Sun, 19 Jan 2014 22:08:10 -0800 Subject: [PATCH] Make it completely pep8 compliant --- Makefile | 2 +- charlatan/_compat.py | 31 ++++++++++--------- charlatan/fixture.py | 1 - charlatan/fixtures_manager.py | 1 - charlatan/tests/test_depgraph.py | 4 +-- .../test_relationships_without_models.py | 3 +- charlatan/tests/test_testcase.py | 4 +-- charlatan/utils.py | 3 +- 8 files changed, 25 insertions(+), 24 deletions(-) diff --git a/Makefile b/Makefile index 9b61878..e15504b 100644 --- a/Makefile +++ b/Makefile @@ -18,7 +18,7 @@ tu: py.test lint: - flake8 charlatan --ignore=E501,E702 + flake8 charlatan coverage: coverage run --source charlatan setup.py test diff --git a/charlatan/_compat.py b/charlatan/_compat.py index 02b6ab2..66cebac 100644 --- a/charlatan/_compat.py +++ b/charlatan/_compat.py @@ -2,23 +2,24 @@ # Copyright (c) 2010-2013 Benjamin Peterson # -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: +# Permission is hereby granted, free of charge, to any person obtaining +# a copy of this software and associated documentation files (the +# "Software"), to deal in the Software without restriction, including +# without limitation the rights to use, copy, modify, merge, publish, +# distribute, sublicense, and/or sell copies of the Software, and to +# permit persons to whom the Software is furnished to do so, subject to +# the following conditions: # -# The above copyright notice and this permission notice shall be included in all -# copies or substantial portions of the Software. +# The above copyright notice and this permission notice shall be +# included in all copies or substantial portions of the Software. # -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -# SOFTWARE. +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. import sys diff --git a/charlatan/fixture.py b/charlatan/fixture.py index 2d73a6c..90d8d34 100644 --- a/charlatan/fixture.py +++ b/charlatan/fixture.py @@ -1,5 +1,4 @@ import copy -import functools import importlib from charlatan.file_format import RelationshipToken diff --git a/charlatan/fixtures_manager.py b/charlatan/fixtures_manager.py index b411493..888bf99 100644 --- a/charlatan/fixtures_manager.py +++ b/charlatan/fixtures_manager.py @@ -1,5 +1,4 @@ from __future__ import print_function -import copy from charlatan import _compat from charlatan.depgraph import DepGraph diff --git a/charlatan/tests/test_depgraph.py b/charlatan/tests/test_depgraph.py index 75b3cf8..ab7a4a8 100644 --- a/charlatan/tests/test_depgraph.py +++ b/charlatan/tests/test_depgraph.py @@ -66,6 +66,6 @@ def test_has_edge_between(self): d.add_edge('c', 'd') d.add_node('e') assert d.has_edge_between('a', 'c') - assert not d.has_edge_between('c', 'a'), 'has_edge_between should not be commutative' - assert not d.has_edge_between('a', 'b'), 'has_edge_between should be edges, not paths' + assert not d.has_edge_between('c', 'a'), 'should not be commutative' + assert not d.has_edge_between('a', 'b'), 'should be edges, not paths' assert not d.has_edge_between('e', 'd') diff --git a/charlatan/tests/test_relationships_without_models.py b/charlatan/tests/test_relationships_without_models.py index 4cfcb2e..8d0be4c 100644 --- a/charlatan/tests/test_relationships_without_models.py +++ b/charlatan/tests/test_relationships_without_models.py @@ -10,7 +10,8 @@ class TestRelationshipsWithoutModels(testing.TestCase, def setUp(self): self.fixtures_manager = FixturesManager() - self.fixtures_manager.load('./charlatan/tests/data/relationships_without_models.yaml') + self.fixtures_manager.load( + './charlatan/tests/data/relationships_without_models.yaml') self.init_fixtures() def test_dictionaries_nest(self): diff --git a/charlatan/tests/test_testcase.py b/charlatan/tests/test_testcase.py index f1281c2..b886775 100644 --- a/charlatan/tests/test_testcase.py +++ b/charlatan/tests/test_testcase.py @@ -46,7 +46,7 @@ def test_install_fixtures(self): self.assertEqual(len(fixtures), 2) def test_install_all_fixtures(self): - """install_all_fixtures should install all fixtures of the yaml file.""" + """Verify it installs all fixtures of the yaml file.""" self.uninstall_all_fixtures() fixtures = self.install_all_fixtures() @@ -66,7 +66,7 @@ def test_uninstall_fixture(self): self.assertEqual(len(fixtures), 0) def test_uninstall_fixtures(self): - """uninstall_fixtures should return the list of uninstalled fixtures.""" + """Verify it returns the list of uninstalled fixtures.""" fixtures = self.uninstall_fixtures(('simple_dict', 'dict_with_nest')) self.assertEqual(len(fixtures), 2) diff --git a/charlatan/utils.py b/charlatan/utils.py index 2e9b903..be12fc4 100644 --- a/charlatan/utils.py +++ b/charlatan/utils.py @@ -101,7 +101,8 @@ def extended_timedelta(**kwargs): days.append([number_of_days[k], kwargs.pop(k)]) if days: - add = int(functools.reduce(operator.add, itertools.starmap(operator.mul, days))) + add = int(functools.reduce( + operator.add, itertools.starmap(operator.mul, days))) kwargs["days"] = kwargs.setdefault("days", 0) + add return datetime.timedelta(**kwargs)