]> git.ipfire.org Git - thirdparty/patchwork.git/commitdiff
pep8: Resolve some issues with lambda functions
authorStephen Finucane <stephen.finucane@intel.com>
Tue, 26 Jan 2016 22:13:43 +0000 (22:13 +0000)
committerStephen Finucane <stephen.finucane@intel.com>
Fri, 5 Feb 2016 17:15:53 +0000 (17:15 +0000)
Signed-off-by: Stephen Finucane <stephen.finucane@intel.com>
patchwork/forms.py
patchwork/tests/browser.py
patchwork/views/user.py

index 808ec8a388217cf46b987fa4093426d5b37b9ebc..628761bc902d9a57fb424aa33e16e1dc307d10d7 100644 (file)
@@ -20,7 +20,6 @@
 from __future__ import absolute_import
 
 from django.contrib.auth.models import User
-from django.db.models.query_utils import Q
 from django import forms
 
 from patchwork.models import Patch, State, Bundle, UserProfile
index 4444f9dcd0f954dd8c8793d74b77009beebeebae..38413d5130cde330d39e395db87accba49e03043 100644 (file)
@@ -21,11 +21,10 @@ import errno
 import os
 import time
 
-import django
-if django.VERSION < (1, 7):
-    from django.test import LiveServerTestCase as StaticLiveServerTestCase
-else:
+try:
     from django.contrib.staticfiles.testing import StaticLiveServerTestCase
+except:  # Django < 1.7
+    from django.test import LiveServerTestCase as StaticLiveServerTestCase
 from selenium.common.exceptions import (
     NoSuchElementException, StaleElementReferenceException,
     TimeoutException)
@@ -139,22 +138,24 @@ class SeleniumTestCase(StaticLiveServerTestCase):
         return self.selenium.switch_to.active_element
 
     def wait_until_present(self, name):
-        is_present = lambda driver: driver.find_element_by_name(name)
+        def is_present(driver):
+            return driver.find_element_by_name(name)
         msg = "An element named '%s' should be on the page" % name
         element = Wait(self.selenium).until(is_present, msg)
         self.screenshot()
         return element
 
     def wait_until_visible(self, selector):
-        is_visible = lambda driver: self.find(selector).is_displayed()
+        def is_visible(driver):
+            return self.find(selector).is_displayed()
         msg = "The element matching '%s' should be visible" % selector
         Wait(self.selenium).until(is_visible, msg)
         self.screenshot()
         return self.find(selector)
 
     def wait_until_focused(self, selector):
-        is_focused = lambda driver: (
-            self.find(selector) == self.focused_element())
+        def is_focused(driver):
+            return self.find(selector) == self.focused_element()
         msg = "The element matching '%s' should be focused" % selector
         Wait(self.selenium).until(is_focused, msg)
         self.screenshot()
index d6e579748d17713a7322e6fe1cf733fe8fb8be5a..dd5eadae074fa5a3d8f1d6818c8db41c9eea4793 100644 (file)
@@ -148,8 +148,8 @@ def link(request):
                           [form.cleaned_data['email']])
             except Exception:
                 context['confirmation'] = None
-                context['error'] = 'An error occurred during confirmation. ' + \
-                                   'Please try again later'
+                context['error'] = ('An error occurred during confirmation. '
+                                    'Please try again later')
     else:
         form = UserPersonLinkForm()
     context['linkform'] = form