From fb9be2a3a6d62b17de752d78f8fe737fd366ad73 Mon Sep 17 00:00:00 2001 From: John Giannelos Date: Mon, 16 Feb 2015 17:36:57 +0200 Subject: [PATCH] Fix W503 pep8 errors. --- remo/events/forms.py | 4 ++-- remo/remozilla/tasks.py | 21 +++++++++++---------- remo/reports/forms.py | 4 ++-- remo/reports/views.py | 4 ++-- remo/voting/forms.py | 6 +++--- remo/voting/models.py | 4 ++-- remo/voting/views.py | 4 ++-- 7 files changed, 24 insertions(+), 23 deletions(-) diff --git a/remo/events/forms.py b/remo/events/forms.py index 7b9da1de1..49dc3c4f6 100644 --- a/remo/events/forms.py +++ b/remo/events/forms.py @@ -68,8 +68,8 @@ def clean(self): return # Disable adding new forms in post event form. - if (self.instance.is_past_event and self.instance.has_new_metrics - and not self.clone): + if ((self.instance.is_past_event and self.instance.has_new_metrics and + not self.clone)): if self.extra_forms and len(self.extra_forms) > 2: error_msg = 'You cannot add new metrics in a past event.' raise ValidationError(error_msg) diff --git a/remo/remozilla/tasks.py b/remo/remozilla/tasks.py index d978ee09a..0170893a4 100644 --- a/remo/remozilla/tasks.py +++ b/remo/remozilla/tasks.py @@ -102,28 +102,29 @@ def fetch_bugs(components=COMPONENTS, days=None): bug.council_member_assigned = False bug.pending_mentor_validation = False for flag in bdata.get('flags', []): - if ((flag['status'] == '?' - and flag['name'] == 'remo-approval')): + if ((flag['status'] == '?' and + flag['name'] == 'remo-approval')): automated_voting_trigger += 1 if 'Council Reviewer Assigned' in bug.whiteboard: bug.council_member_assigned = True - if ((flag['status'] == '?' - and flag['name'] == 'needinfo' - and 'requestee' in flag - and flag['requestee']['name'] == ( + if ((flag['status'] == '?' and + flag['name'] == 'needinfo' and + 'requestee' in flag and + flag['requestee']['name'] == ( settings.REPS_COUNCIL_ALIAS))): automated_voting_trigger += 1 if flag['status'] == '?' and flag['name'] == 'remo-review': bug.pending_mentor_validation = True - if (flag['status'] == '?' and flag['name'] == 'needinfo' - and 'requestee' in flag): + if ((flag['status'] == '?' and + flag['name'] == 'needinfo' and + 'requestee' in flag)): email = flag['requestee']['name'] user = get_object_or_none(User, email=email) if user: bug.budget_needinfo.add(user) - if ((automated_voting_trigger == 2 - and waffle.switch_is_active('automated_polls'))): + if ((automated_voting_trigger == 2 and + waffle.switch_is_active('automated_polls'))): bug.council_vote_requested = True comments = bdata.get('comments', []) diff --git a/remo/reports/forms.py b/remo/reports/forms.py index 7278e5f5b..89a2a981c 100644 --- a/remo/reports/forms.py +++ b/remo/reports/forms.py @@ -44,8 +44,8 @@ def clean(self): cdata = self.cleaned_data activity = cdata.get('activity') - if (activity and activity.name == ACTIVITY_CAMPAIGN - and not cdata.get('campaign')): + if ((activity and activity.name == ACTIVITY_CAMPAIGN and + not cdata.get('campaign'))): msg = 'Please select an option from the list.' self._errors['campaign'] = self.error_class([msg]) diff --git a/remo/reports/views.py b/remo/reports/views.py index ce0bea797..c98409f02 100644 --- a/remo/reports/views.py +++ b/remo/reports/views.py @@ -93,8 +93,8 @@ def view_ng_report(request, display_name, year, month, day=None, id=None): verification_form = forms.NGVerifyReportForm(instance=report) editable = False - if ((request.user == user or request.user.has_perm('change_ngreport')) - and report.activity.name not in UNLISTED_ACTIVITIES): + if (((request.user == user or request.user.has_perm('change_ngreport')) and + (report.activity.name not in UNLISTED_ACTIVITIES))): editable = True ctx_data = {'pageuser': user, diff --git a/remo/voting/forms.py b/remo/voting/forms.py index 6c9141a93..50ab7e8fc 100644 --- a/remo/voting/forms.py +++ b/remo/voting/forms.py @@ -155,9 +155,9 @@ def __init__(self, *args, **kwargs): def is_valid(self): """Override the is_valid() method.""" - return (super(PollAddForm, self).is_valid() - and (self.range_poll_formset.is_valid() - and self.radio_poll_formset.is_valid())) + return (super(PollAddForm, self).is_valid() and + self.range_poll_formset.is_valid() and + self.radio_poll_formset.is_valid()) def clean(self): """Clean form.""" diff --git a/remo/voting/models.py b/remo/voting/models.py index d63998eec..bfea4f801 100644 --- a/remo/voting/models.py +++ b/remo/voting/models.py @@ -286,8 +286,8 @@ def automated_poll(sender, instance, **kwargs): a new Poll and let Council members vote. """ - if ((not instance.council_vote_requested - or Poll.objects.filter(bug=instance).exists())): + if ((not instance.council_vote_requested or + Poll.objects.filter(bug=instance).exists())): return remobot = User.objects.get(username='remobot') diff --git a/remo/voting/views.py b/remo/voting/views.py index 10d1c4e01..3aec264e6 100644 --- a/remo/voting/views.py +++ b/remo/voting/views.py @@ -199,8 +199,8 @@ def view_voting(request, slug): # Process poll form forms_valid = True # validate all forms - for item in (range_poll_choice_forms.values() - + radio_poll_choice_forms.values()): + for item in (range_poll_choice_forms.values() + + radio_poll_choice_forms.values()): if not item.is_valid(): forms_valid = False break