You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by da...@apache.org on 2016/08/02 18:33:39 UTC
incubator-airflow git commit: [AIRFLOW-375] Pylint fixes
Repository: incubator-airflow
Updated Branches:
refs/heads/master 3cef8ed28 -> b39cbdba0
[AIRFLOW-375] Pylint fixes
Closes #1690 from zodiac/xuanji_fix_pylint
Project: http://git-wip-us.apache.org/repos/asf/incubator-airflow/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-airflow/commit/b39cbdba
Tree: http://git-wip-us.apache.org/repos/asf/incubator-airflow/tree/b39cbdba
Diff: http://git-wip-us.apache.org/repos/asf/incubator-airflow/diff/b39cbdba
Branch: refs/heads/master
Commit: b39cbdba0bf3c5fd4bdff700266918d756790a84
Parents: 3cef8ed
Author: Li Xuanji <xu...@gmail.com>
Authored: Tue Aug 2 11:33:01 2016 -0700
Committer: Dan Davydov <da...@airbnb.com>
Committed: Tue Aug 2 11:33:16 2016 -0700
----------------------------------------------------------------------
airflow/contrib/hooks/bigquery_hook.py | 5 ++++-
airflow/contrib/hooks/cloudant_hook.py | 4 +++-
airflow/contrib/operators/dataflow_operator.py | 8 ++++++--
airflow/contrib/operators/emr_add_steps_operator.py | 3 ++-
airflow/hooks/__init__.py | 1 -
airflow/operators/__init__.py | 1 -
airflow/operators/sensors.py | 2 ++
airflow/security/kerberos.py | 9 ++-------
airflow/www/views.py | 6 +++---
9 files changed, 22 insertions(+), 17 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-airflow/blob/b39cbdba/airflow/contrib/hooks/bigquery_hook.py
----------------------------------------------------------------------
diff --git a/airflow/contrib/hooks/bigquery_hook.py b/airflow/contrib/hooks/bigquery_hook.py
index 2d1b243..f24ac1e 100644
--- a/airflow/contrib/hooks/bigquery_hook.py
+++ b/airflow/contrib/hooks/bigquery_hook.py
@@ -18,6 +18,9 @@ This module contains a BigQuery Hook, as well as a very basic PEP 249
implementation for BigQuery.
"""
+from builtins import range
+from past.builtins import basestring
+
import logging
import time
@@ -717,7 +720,7 @@ class BigQueryCursor(BigQueryBaseCursor):
if size is None:
size = self.arraysize
result = []
- for _ in xrange(size):
+ for _ in range(size):
one = self.fetchone()
if one is None:
break
http://git-wip-us.apache.org/repos/asf/incubator-airflow/blob/b39cbdba/airflow/contrib/hooks/cloudant_hook.py
----------------------------------------------------------------------
diff --git a/airflow/contrib/hooks/cloudant_hook.py b/airflow/contrib/hooks/cloudant_hook.py
index e0ac13a..6cea26f 100644
--- a/airflow/contrib/hooks/cloudant_hook.py
+++ b/airflow/contrib/hooks/cloudant_hook.py
@@ -11,9 +11,11 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
-import logging
+
+from past.builtins import unicode
import cloudant
+import logging
from airflow.exceptions import AirflowException
from airflow.hooks.base_hook import BaseHook
http://git-wip-us.apache.org/repos/asf/incubator-airflow/blob/b39cbdba/airflow/contrib/operators/dataflow_operator.py
----------------------------------------------------------------------
diff --git a/airflow/contrib/operators/dataflow_operator.py b/airflow/contrib/operators/dataflow_operator.py
index 8f61e18..10a6811 100644
--- a/airflow/contrib/operators/dataflow_operator.py
+++ b/airflow/contrib/operators/dataflow_operator.py
@@ -63,8 +63,8 @@ class DataFlowJavaOperator(BaseOperator):
def __init__(
self,
jar,
- dataflow_default_options={},
- options={},
+ dataflow_default_options=None,
+ options=None,
gcp_conn_id='google_cloud_default',
delegate_to=None,
*args,
@@ -90,6 +90,10 @@ class DataFlowJavaOperator(BaseOperator):
:type delegate_to: string
"""
super(DataFlowJavaOperator, self).__init__(*args, **kwargs)
+
+ dataflow_default_options = dataflow_default_options or {}
+ options = options or {}
+
self.gcp_conn_id = gcp_conn_id
self.delegate_to = delegate_to
self.jar = jar
http://git-wip-us.apache.org/repos/asf/incubator-airflow/blob/b39cbdba/airflow/contrib/operators/emr_add_steps_operator.py
----------------------------------------------------------------------
diff --git a/airflow/contrib/operators/emr_add_steps_operator.py b/airflow/contrib/operators/emr_add_steps_operator.py
index 342df5b..84ef2d0 100644
--- a/airflow/contrib/operators/emr_add_steps_operator.py
+++ b/airflow/contrib/operators/emr_add_steps_operator.py
@@ -40,9 +40,10 @@ class EmrAddStepsOperator(BaseOperator):
self,
job_flow_id,
aws_conn_id='s3_default',
- steps=[],
+ steps=None,
*args, **kwargs):
super(EmrAddStepsOperator, self).__init__(*args, **kwargs)
+ steps = steps or []
self.job_flow_id = job_flow_id
self.aws_conn_id = aws_conn_id
self.steps = steps
http://git-wip-us.apache.org/repos/asf/incubator-airflow/blob/b39cbdba/airflow/hooks/__init__.py
----------------------------------------------------------------------
diff --git a/airflow/hooks/__init__.py b/airflow/hooks/__init__.py
index 883018d..8942bff 100644
--- a/airflow/hooks/__init__.py
+++ b/airflow/hooks/__init__.py
@@ -64,7 +64,6 @@ if not _os.environ.get('AIRFLOW_USE_NEW_IMPORTS', False):
def _integrate_plugins():
"""Integrate plugins to the context"""
- import sys
from airflow.plugins_manager import hooks as _hooks
for _hook_module in _hooks:
sys.modules[_hook_module.__name__] = _hook_module
http://git-wip-us.apache.org/repos/asf/incubator-airflow/blob/b39cbdba/airflow/operators/__init__.py
----------------------------------------------------------------------
diff --git a/airflow/operators/__init__.py b/airflow/operators/__init__.py
index 67c4db9..f39ad01 100644
--- a/airflow/operators/__init__.py
+++ b/airflow/operators/__init__.py
@@ -100,7 +100,6 @@ if not _os.environ.get('AIRFLOW_USE_NEW_IMPORTS', False):
def _integrate_plugins():
"""Integrate plugins to the context"""
- import sys
from airflow.plugins_manager import operators as _operators
for _operator_module in _operators:
sys.modules[_operator_module.__name__] = _operator_module
http://git-wip-us.apache.org/repos/asf/incubator-airflow/blob/b39cbdba/airflow/operators/sensors.py
----------------------------------------------------------------------
diff --git a/airflow/operators/sensors.py b/airflow/operators/sensors.py
index 9f7f380..fbc8569 100644
--- a/airflow/operators/sensors.py
+++ b/airflow/operators/sensors.py
@@ -16,6 +16,8 @@ from __future__ import print_function
from future import standard_library
standard_library.install_aliases()
from builtins import str
+from past.builtins import basestring
+
from datetime import datetime
import logging
from urllib.parse import urlparse
http://git-wip-us.apache.org/repos/asf/incubator-airflow/blob/b39cbdba/airflow/security/kerberos.py
----------------------------------------------------------------------
diff --git a/airflow/security/kerberos.py b/airflow/security/kerberos.py
index 9d60059..08e5ed3 100644
--- a/airflow/security/kerberos.py
+++ b/airflow/security/kerberos.py
@@ -93,13 +93,8 @@ def detect_conf_var():
Sun Java Krb5LoginModule in Java6, so we need to take an action to work
around it.
"""
- f = file(configuration.get('kerberos', 'ccache'), "rb")
-
- try:
- data = f.read()
- return "X-CACHECONF:" in data
- finally:
- f.close()
+ with open(configuration.get('kerberos', 'ccache'), "rb") as f:
+ return "X-CACHECONF:" in f.read()
def run():
http://git-wip-us.apache.org/repos/asf/incubator-airflow/blob/b39cbdba/airflow/www/views.py
----------------------------------------------------------------------
diff --git a/airflow/www/views.py b/airflow/www/views.py
index a40fe23..9d5f637 100644
--- a/airflow/www/views.py
+++ b/airflow/www/views.py
@@ -13,6 +13,9 @@
# limitations under the License.
#
+from past.utils import old_div
+from past.builtins import basestring, unicode
+
import os
import pkg_resources
import socket
@@ -24,9 +27,6 @@ import copy
from itertools import chain, product
import json
-from past.utils import old_div
-from past.builtins import basestring
-
import inspect
import traceback