You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2019/01/02 06:49:40 UTC

[GitHub] feng-tao closed pull request #4415: [AIRFLOW-3606] Fix Flake8 test & fix the Flake8 errors introduced since Flake8 test was broken

feng-tao closed pull request #4415: [AIRFLOW-3606] Fix Flake8 test & fix the Flake8 errors introduced since Flake8 test was broken
URL: https://github.com/apache/incubator-airflow/pull/4415
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/.flake8 b/.flake8
index 9c4bbcd661..2723df1f10 100644
--- a/.flake8
+++ b/.flake8
@@ -1,4 +1,3 @@
 [flake8]
 max-line-length = 110
 ignore = E731
-exclude = .git, env, venv, .venv, VENV, .tox, .eggs, .*
diff --git a/airflow/bin/cli.py b/airflow/bin/cli.py
index f4bee90c52..877bf34e20 100644
--- a/airflow/bin/cli.py
+++ b/airflow/bin/cli.py
@@ -69,7 +69,6 @@
 from airflow.www_rbac.app import create_app as create_app_rbac
 from airflow.www_rbac.app import cached_appbuilder
 
-from sqlalchemy import func
 from sqlalchemy.orm import exc
 
 api.load_auth()
diff --git a/airflow/migrations/versions/a56c9515abdc_remove_dag_stat_table.py b/airflow/migrations/versions/a56c9515abdc_remove_dag_stat_table.py
index 4cba5a0fbb..89dba33c3e 100644
--- a/airflow/migrations/versions/a56c9515abdc_remove_dag_stat_table.py
+++ b/airflow/migrations/versions/a56c9515abdc_remove_dag_stat_table.py
@@ -6,9 +6,9 @@
 # to you under the Apache License, Version 2.0 (the
 # "License"); you may not use this file except in compliance
 # with the License.  You may obtain a copy of the License at
-# 
+#
 #   http://www.apache.org/licenses/LICENSE-2.0
-# 
+#
 # Unless required by applicable law or agreed to in writing,
 # software distributed under the License is distributed on an
 # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@@ -24,15 +24,15 @@
 
 """
 
+from alembic import op
+import sqlalchemy as sa
+
 # revision identifiers, used by Alembic.
 revision = 'a56c9515abdc'
 down_revision = 'c8ffec048a3b'
 branch_labels = None
 depends_on = None
 
-from alembic import op
-import sqlalchemy as sa
-
 
 def upgrade():
     op.drop_table("dag_stats")
diff --git a/airflow/migrations/versions/c8ffec048a3b_add_fields_to_dag.py b/airflow/migrations/versions/c8ffec048a3b_add_fields_to_dag.py
index a74e0b50a4..70282715ed 100644
--- a/airflow/migrations/versions/c8ffec048a3b_add_fields_to_dag.py
+++ b/airflow/migrations/versions/c8ffec048a3b_add_fields_to_dag.py
@@ -6,9 +6,9 @@
 # to you under the Apache License, Version 2.0 (the
 # "License"); you may not use this file except in compliance
 # with the License.  You may obtain a copy of the License at
-# 
+#
 #   http://www.apache.org/licenses/LICENSE-2.0
-# 
+#
 # Unless required by applicable law or agreed to in writing,
 # software distributed under the License is distributed on an
 # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@@ -24,15 +24,15 @@
 
 """
 
+from alembic import op
+import sqlalchemy as sa
+
 # revision identifiers, used by Alembic.
 revision = 'c8ffec048a3b'
 down_revision = '41f5f12752f8'
 branch_labels = None
 depends_on = None
 
-from alembic import op
-import sqlalchemy as sa
-
 
 def upgrade():
     op.add_column('dag', sa.Column('description', sa.Text(), nullable=True))
diff --git a/airflow/models/__init__.py b/airflow/models/__init__.py
index d1236fa40b..b2561e2fdb 100755
--- a/airflow/models/__init__.py
+++ b/airflow/models/__init__.py
@@ -43,7 +43,6 @@
 import getpass
 import imp
 import importlib
-import itertools
 import zipfile
 import jinja2
 import json
diff --git a/airflow/www/views.py b/airflow/www/views.py
index 7746fb6de5..96644cc29e 100644
--- a/airflow/www/views.py
+++ b/airflow/www/views.py
@@ -554,7 +554,9 @@ def dag_stats(self, session=None):
         dm = models.DagModel
         dag_ids = session.query(dm.dag_id)
 
-        dag_state_stats = session.query(dr.dag_id, dr.state, sqla.func.count(dr.state)).group_by(dr.dag_id, dr.state)
+        dag_state_stats = (
+            session.query(dr.dag_id, dr.state, sqla.func.count(dr.state)).group_by(dr.dag_id, dr.state)
+        )
 
         data = {}
         for (dag_id, ) in dag_ids:
diff --git a/airflow/www_rbac/views.py b/airflow/www_rbac/views.py
index 17efcdfe7c..1d423f65f6 100644
--- a/airflow/www_rbac/views.py
+++ b/airflow/www_rbac/views.py
@@ -281,7 +281,8 @@ def dag_stats(self, session=None):
 
         filter_dag_ids = appbuilder.sm.get_accessible_dag_ids()
 
-        dag_state_stats = session.query(dr.dag_id, dr.state, sqla.func.count(dr.state)).group_by(dr.dag_id, dr.state)
+        dag_state_stats = session.query(dr.dag_id, dr.state, sqla.func.count(dr.state))\
+            .group_by(dr.dag_id, dr.state)
 
         payload = {}
         if filter_dag_ids:
diff --git a/tests/contrib/executors/test_kubernetes_executor.py b/tests/contrib/executors/test_kubernetes_executor.py
index 4836693002..4acb97086f 100644
--- a/tests/contrib/executors/test_kubernetes_executor.py
+++ b/tests/contrib/executors/test_kubernetes_executor.py
@@ -243,7 +243,8 @@ def test_worker_git_dags(self):
         self.assertTrue(dag_volume_mount[0]['readOnly'])
 
         init_container = worker_config._get_init_containers(volume_mounts)[0]
-        init_container_volume_mount = [mount for mount in init_container['volumeMounts'] if mount['name'] == 'airflow-dags']
+        init_container_volume_mount = [mount for mount in init_container['volumeMounts']
+                                       if mount['name'] == 'airflow-dags']
 
         self.assertEqual('git-sync-clone', init_container['name'])
         self.assertEqual('gcr.io/google-containers/git-sync-amd64:v2.0.5', init_container['image'])
diff --git a/tests/models.py b/tests/models.py
index 2b4e9ef797..a4f3aad367 100644
--- a/tests/models.py
+++ b/tests/models.py
@@ -747,7 +747,8 @@ def test_sync_to_db(self, mock_now):
         self.assertEqual(orm_dag.last_scheduler_run, now)
         self.assertTrue(orm_dag.is_active)
         self.assertIsNone(orm_dag.default_view)
-        self.assertEqual(orm_dag.get_default_view(), configuration.conf.get('webserver', 'dag_default_view').lower())
+        self.assertEqual(orm_dag.get_default_view(),
+                         configuration.conf.get('webserver', 'dag_default_view').lower())
 
         orm_subdag = session.query(DagModel).filter(
             DagModel.dag_id == 'dag.subtask').one()
diff --git a/tests/www/test_views.py b/tests/www/test_views.py
index aeaca96333..5446086d18 100644
--- a/tests/www/test_views.py
+++ b/tests/www/test_views.py
@@ -30,7 +30,6 @@
 
 from urllib.parse import quote_plus
 from werkzeug.test import Client
-from sqlalchemy import func
 
 from airflow import models, configuration
 from airflow.config_templates.airflow_local_settings import DEFAULT_LOGGING_CONFIG
diff --git a/tests/www_rbac/test_views.py b/tests/www_rbac/test_views.py
index 0f0de56cea..8e5eed69d2 100644
--- a/tests/www_rbac/test_views.py
+++ b/tests/www_rbac/test_views.py
@@ -1448,7 +1448,7 @@ def test_trigger_dag_button(self):
         self.session.query(DR).delete()
         self.session.commit()
 
-        resp = self.client.get('trigger?dag_id={}'.format(test_dag_id))
+        self.client.get('trigger?dag_id={}'.format(test_dag_id))
 
         run = self.session.query(DR).filter(DR.dag_id == test_dag_id).first()
         self.assertIsNotNone(run)


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services