Skip to content
This repository has been archived by the owner on Oct 28, 2020. It is now read-only.

Commit

Permalink
Merge pull request #937 from johngian/pep8-fixes
Browse files Browse the repository at this point in the history
Fix W503 pep8 errors.
  • Loading branch information
johngian committed Feb 16, 2015
2 parents 01e59dd + fb9be2a commit 7d4dabb
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 23 deletions.
4 changes: 2 additions & 2 deletions remo/events/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
21 changes: 11 additions & 10 deletions remo/remozilla/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -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', [])
Expand Down
4 changes: 2 additions & 2 deletions remo/reports/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -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])

Expand Down
4 changes: 2 additions & 2 deletions remo/reports/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
6 changes: 3 additions & 3 deletions remo/voting/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -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."""
Expand Down
4 changes: 2 additions & 2 deletions remo/voting/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down
4 changes: 2 additions & 2 deletions remo/voting/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 7d4dabb

Please sign in to comment.