You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airavata.apache.org by ma...@apache.org on 2020/11/04 15:54:40 UTC

[airavata-django-portal] branch develop updated: AIRAVATA-3376 Upgrading pyflakes, etc. to work with Python 3.8

This is an automated email from the ASF dual-hosted git repository.

machristie pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/airavata-django-portal.git


The following commit(s) were added to refs/heads/develop by this push:
     new 48de36b  AIRAVATA-3376 Upgrading pyflakes, etc. to work with Python 3.8
48de36b is described below

commit 48de36b583df49330b3626840637b97c5b69fc56
Author: Marcus Christie <ma...@apache.org>
AuthorDate: Wed Nov 4 10:54:20 2020 -0500

    AIRAVATA-3376 Upgrading pyflakes, etc. to work with Python 3.8
---
 django_airavata/apps/api/helpers.py        | 2 +-
 django_airavata/apps/api/output_views.py   | 4 ++--
 django_airavata/apps/api/serializers.py    | 2 +-
 django_airavata/apps/api/views.py          | 6 +++---
 django_airavata/apps/auth/backends.py      | 2 +-
 django_airavata/apps/auth/views.py         | 6 +++---
 django_airavata/apps/workspace/views.py    | 4 ++--
 django_airavata/context_processors.py      | 2 +-
 django_airavata/wagtailapps/base/models.py | 4 ++--
 requirements-dev.txt                       | 7 ++++---
 setup.cfg                                  | 2 +-
 11 files changed, 21 insertions(+), 20 deletions(-)

diff --git a/django_airavata/apps/api/helpers.py b/django_airavata/apps/api/helpers.py
index 4a5eafd..19a1077 100644
--- a/django_airavata/apps/api/helpers.py
+++ b/django_airavata/apps/api/helpers.py
@@ -16,7 +16,7 @@ class WorkspacePreferencesHelper:
             workspace_preferences = models.WorkspacePreferences.objects.get(
                 username=request.user.username)
             self._check(request, workspace_preferences)
-        except ObjectDoesNotExist as e:
+        except ObjectDoesNotExist:
             workspace_preferences = self._create_default(request)
             workspace_preferences.save()
         return workspace_preferences
diff --git a/django_airavata/apps/api/output_views.py b/django_airavata/apps/api/output_views.py
index 297ab6e..4d3eb55 100644
--- a/django_airavata/apps/api/output_views.py
+++ b/django_airavata/apps/api/output_views.py
@@ -123,7 +123,7 @@ def _get_output_view_providers(experiment_output, application_interface):
             if 'output-view-providers' in output_metadata:
                 output_view_providers.extend(
                     output_metadata['output-view-providers'])
-        except Exception as e:
+        except Exception:
             logger.exception(
                 "Failed to parse metadata for output {}".format(
                     experiment_output.name))
@@ -153,7 +153,7 @@ def _get_application_output_view_providers(application_interface, output_name):
             output_metadata = json.loads(app_output.metaData)
             if 'output-view-providers' in output_metadata:
                 return output_metadata['output-view-providers']
-        except Exception as e:
+        except Exception:
             logger.exception(
                 "Failed to parse metadata for output {}".format(
                     app_output.name))
diff --git a/django_airavata/apps/api/serializers.py b/django_airavata/apps/api/serializers.py
index e8dc74b..43d10f6 100644
--- a/django_airavata/apps/api/serializers.py
+++ b/django_airavata/apps/api/serializers.py
@@ -77,7 +77,7 @@ class FullyEncodedHyperlinkedIdentityField(
             lookup_value = obj.get(self.lookup_field)
         try:
             encoded_lookup_value = quote(lookup_value, safe="")
-        except Exception as e:
+        except Exception:
             log.warning(
                 "Failed to encode lookup_value [{}] for lookup_field "
                 "[{}] of object [{}]".format(
diff --git a/django_airavata/apps/api/views.py b/django_airavata/apps/api/views.py
index 9c56603..878f60a 100644
--- a/django_airavata/apps/api/views.py
+++ b/django_airavata/apps/api/views.py
@@ -506,7 +506,7 @@ class FullExperimentViewSet(mixins.RetrieveModelMixin,
         try:
             applicationInterface = self.request.airavata_client \
                 .getApplicationInterface(self.authz_token, appInterfaceId)
-        except Exception as e:
+        except Exception:
             log.exception("Failed to load app interface")
             applicationInterface = None
         exp_output_views = output_views.get_output_views(
@@ -535,7 +535,7 @@ class FullExperimentViewSet(mixins.RetrieveModelMixin,
             else:
                 log.warning(
                     "Cannot log application model since app interface failed to load")
-        except Exception as e:
+        except Exception:
             log.exception("Failed to load app interface/module")
             applicationModule = None
 
@@ -548,7 +548,7 @@ class FullExperimentViewSet(mixins.RetrieveModelMixin,
             compute_resource = self.request.airavata_client.getComputeResource(
                 self.authz_token, compute_resource_id) \
                 if compute_resource_id else None
-        except Exception as e:
+        except Exception:
             log.exception("Failed to load compute resource for {}".format(
                 compute_resource_id))
             compute_resource = None
diff --git a/django_airavata/apps/auth/backends.py b/django_airavata/apps/auth/backends.py
index 5bb832a..d25f53e 100644
--- a/django_airavata/apps/auth/backends.py
+++ b/django_airavata/apps/auth/backends.py
@@ -77,7 +77,7 @@ class KeycloakBackend(object):
                 request.authz_token = get_authz_token(
                     request, user=user, access_token=access_token)
             return user
-        except Exception as e:
+        except Exception:
             logger.exception("login failed")
             return None
 
diff --git a/django_airavata/apps/auth/views.py b/django_airavata/apps/auth/views.py
index d87b031..0fe55b0 100644
--- a/django_airavata/apps/auth/views.py
+++ b/django_airavata/apps/auth/views.py
@@ -248,7 +248,7 @@ def verify_email(request, code):
                 "Your account has been successfully created. "
                 "Please log in now.")
             return redirect(login_url)
-    except ObjectDoesNotExist as e:
+    except ObjectDoesNotExist:
         # if doesn't exist, give user a form where they can enter their
         # username to resend verification code
         logger.exception("EmailVerification object doesn't exist for "
@@ -258,7 +258,7 @@ def verify_email(request, code):
             "Email verification failed. Please enter your username and we "
             "will send you another email verification link.")
         return redirect(reverse('django_airavata_auth:resend_email_link'))
-    except Exception as e:
+    except Exception:
         logger.exception("Email verification processing failed!")
         messages.error(
             request,
@@ -403,7 +403,7 @@ def reset_password(request, code):
     try:
         password_reset_request = models.PasswordResetRequest.objects.get(
             reset_code=code)
-    except ObjectDoesNotExist as e:
+    except ObjectDoesNotExist:
         messages.error(
             request,
             "Reset password link is invalid. Please try again.")
diff --git a/django_airavata/apps/workspace/views.py b/django_airavata/apps/workspace/views.py
index b29103b..3f6d336 100644
--- a/django_airavata/apps/workspace/views.py
+++ b/django_airavata/apps/workspace/views.py
@@ -96,10 +96,10 @@ def create_experiment(request, app_module_id):
                             request.authz_token, dp_uri)
                         if user_storage_sdk.exists(request, data_product):
                             user_input_values[app_input['name']] = dp_uri
-                    except Exception as e:
+                    except Exception:
                         logger.exception(
                             f"Failed checking data product uri: {dp_uri}")
-            except ValueError as e:
+            except ValueError:
                 logger.exception(f"Invalid user file value: {user_file_value}")
         elif (app_input['type'] == DataType.STRING and
               app_input['name'] in request.GET):
diff --git a/django_airavata/context_processors.py b/django_airavata/context_processors.py
index 866bd63..6fa8338 100644
--- a/django_airavata/context_processors.py
+++ b/django_airavata/context_processors.py
@@ -24,7 +24,7 @@ def get_notifications(request):
         try:
             notifications = request.airavata_client.getAllNotifications(
                 request.authz_token, settings.GATEWAY_ID)
-        except Exception as e:
+        except Exception:
             logger.warning("Failed to load notifications")
             notifications = []
         current_time = datetime.datetime.utcnow()
diff --git a/django_airavata/wagtailapps/base/models.py b/django_airavata/wagtailapps/base/models.py
index 01b3980..db2360d 100644
--- a/django_airavata/wagtailapps/base/models.py
+++ b/django_airavata/wagtailapps/base/models.py
@@ -391,8 +391,8 @@ class ExtraWebResources(ClusterableModel):
     def __str__(self):
         try:
             return "Extra Web Resources: {}".format(", ".join(
-                [os.path.basename(l.url) for l in self.css_links.all()] +
-                [os.path.basename(l.url) for l in self.js_links.all()]))
+                [os.path.basename(link.url) for link in self.css_links.all()] +
+                [os.path.basename(link.url) for link in self.js_links.all()]))
         except Exception:
             return "Extra Web Resources"
 
diff --git a/requirements-dev.txt b/requirements-dev.txt
index 91072bf..40c56a4 100644
--- a/requirements-dev.txt
+++ b/requirements-dev.txt
@@ -1,11 +1,12 @@
 -r requirements.txt
-autopep8==1.3.5
-flake8==3.5.0
+autopep8==1.5.4
+flake8==3.8.4
 flake8-isort==4.0.0
 isort==5.2.2
 mkdocs==1.0.4
 Markdown==3.2.1
-pycodestyle==2.3.1
+pycodestyle==2.6.0
+pyflakes==2.2.0
 tox==3.20.0
 
 -e ".[dev]"
diff --git a/setup.cfg b/setup.cfg
index f157058..8ecf4ee 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -6,7 +6,7 @@ exclude =
     settings_local.py,
     */migrations,
     .tox
-ignore = E501
+ignore = E501, W504
 
 [isort]
 # Set multi_line_output to option 3 - Vertical Hanging Indent