Skip to content

Commit

Permalink
[AIRFLOW-315] Fix blank lines code style warnings
Browse files Browse the repository at this point in the history
Closes apache#1653 from skudriashev/airflow-315
  • Loading branch information
skudriashev authored and jlowin committed Jul 14, 2016
1 parent 9f76427 commit 6c7c52c
Show file tree
Hide file tree
Showing 37 changed files with 47 additions and 9 deletions.
1 change: 1 addition & 0 deletions airflow/bin/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -1026,5 +1026,6 @@ def get_parser(cls, dag_parser=False):
sp.set_defaults(func=sub['func'])
return parser


def get_parser():
return CLIFactory.get_parser()
1 change: 1 addition & 0 deletions airflow/configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
warnings.filterwarnings(
action='default', category=PendingDeprecationWarning, module='airflow')


class AirflowConfigException(Exception):
pass

Expand Down
1 change: 1 addition & 0 deletions airflow/contrib/auth/backends/github_enterprise_auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@

_log = logging.getLogger(__name__)


def get_config_param(param):
return str(configuration.get('github_enterprise', param))

Expand Down
1 change: 1 addition & 0 deletions airflow/contrib/auth/backends/ldap_auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
class AuthenticationError(Exception):
pass


class LdapException(Exception):
pass

Expand Down
1 change: 1 addition & 0 deletions airflow/contrib/auth/backends/password_auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
LOG = logging.getLogger(__name__)
PY3 = version_info[0] == 3


class AuthenticationError(Exception):
pass

Expand Down
1 change: 1 addition & 0 deletions airflow/contrib/hooks/datastore_hook.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
from apiclient.discovery import build
from airflow.contrib.hooks.gcp_api_base_hook import GoogleCloudBaseHook


class DatastoreHook(GoogleCloudBaseHook):
"""
Interact with Google Cloud Datastore. This hook uses the Google Cloud Platform
Expand Down
1 change: 1 addition & 0 deletions airflow/contrib/hooks/qubole_hook.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
'dbimportcmd': ['mode', 'hive_table', 'dbtap_id', 'db_table', 'where_clause', 'parallelism', 'extract_query', 'boundary_query', 'split_column', 'tags', 'name']
}


class QuboleHook(BaseHook):
def __init__(self, *args, **kwargs):
conn = self.get_connection(kwargs['qubole_conn_id'])
Expand Down
1 change: 1 addition & 0 deletions airflow/contrib/hooks/vertica_hook.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

from airflow.hooks.dbapi_hook import DbApiHook


class VerticaHook(DbApiHook):
'''
Interact with Vertica.
Expand Down
1 change: 1 addition & 0 deletions airflow/contrib/operators/bigquery_operator.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
from airflow.models import BaseOperator
from airflow.utils.decorators import apply_defaults


class BigQueryOperator(BaseOperator):
"""
Executes BigQuery SQL queries in a specific BigQuery database
Expand Down
1 change: 1 addition & 0 deletions airflow/contrib/operators/bigquery_to_bigquery.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
from airflow.models import BaseOperator
from airflow.utils.decorators import apply_defaults


class BigQueryToBigQueryOperator(BaseOperator):
"""
Copy a BigQuery table to another BigQuery table.
Expand Down
1 change: 1 addition & 0 deletions airflow/contrib/operators/bigquery_to_gcs.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
from airflow.models import BaseOperator
from airflow.utils.decorators import apply_defaults


class BigQueryToCloudStorageOperator(BaseOperator):
"""
Transfers a BigQuery table to a Google Cloud Storage bucket.
Expand Down
1 change: 1 addition & 0 deletions airflow/contrib/operators/fs_operator.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
from airflow.contrib.hooks.fs_hook import FSHook
from airflow.utils.decorators import apply_defaults


class FileSensor(BaseSensorOperator):
"""
Waits for a file or folder to land in a filesystem
Expand Down
1 change: 1 addition & 0 deletions airflow/contrib/operators/gcs_download_operator.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
from airflow.models import BaseOperator
from airflow.utils.decorators import apply_defaults


class GoogleCloudStorageDownloadOperator(BaseOperator):
"""
Downloads a file from Google Cloud Storage.
Expand Down
1 change: 1 addition & 0 deletions airflow/contrib/operators/gcs_to_bq.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
from airflow.models import BaseOperator
from airflow.utils.decorators import apply_defaults


class GoogleCloudStorageToBigQueryOperator(BaseOperator):
"""
Loads files from Google cloud storage into BigQuery.
Expand Down
1 change: 1 addition & 0 deletions airflow/contrib/operators/mysql_to_gcs.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
from MySQLdb.constants import FIELD_TYPE
from tempfile import NamedTemporaryFile


class MySqlToGoogleCloudStorageOperator(BaseOperator):
"""
Copy data from MySQL to Google cloud storage in JSON format.
Expand Down
1 change: 1 addition & 0 deletions airflow/contrib/operators/vertica_to_hive.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
from airflow.models import BaseOperator
from airflow.utils.decorators import apply_defaults


class VerticaToHiveTransfer(BaseOperator):
"""
Moves data from Vertia to Hive. The operator runs
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
# alternating runs
dag = DAG(dag_id='example_branch_dop_operator_v3',schedule_interval='*/1 * * * *', default_args=args)


def should_run(ds, **kwargs):

print("------------- exec dttm = {} and minute = {}".format(kwargs['execution_date'], kwargs['execution_date'].minute))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
dagrun_timeout=timedelta(minutes=4)
)


def my_py_command(ds, **kwargs):
# Print out the "foo" param passed in via
# `airflow test example_passing_params_via_test_command run_this <date>
Expand Down
3 changes: 3 additions & 0 deletions airflow/example_dags/example_xcom.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,17 @@
value_1 = [1, 2, 3]
value_2 = {'a': 'b'}


def push(**kwargs):
# pushes an XCom without a specific target
kwargs['ti'].xcom_push(key='value from pusher 1', value=value_1)


def push_by_returning(**kwargs):
# pushes an XCom without a specific target, just by returning it
return value_2


def puller(**kwargs):
ti = kwargs['ti']

Expand Down
11 changes: 4 additions & 7 deletions airflow/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,10 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
#
# Any AirflowException raised is expected to cause the TaskInstance to be marked in an ERROR state
#
# Note: Any AirflowException raised is expected to cause the TaskInstance
# to be marked in an ERROR state


class AirflowException(Exception):
pass

Expand All @@ -27,9 +28,5 @@ class AirflowTaskTimeout(AirflowException):
pass


#
# Any AirflowSkipException raised is expected to cause the TaskInstance to be marked in an SKIPPED state
#
class AirflowSkipException(AirflowException):
pass

1 change: 1 addition & 0 deletions airflow/hooks/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@
from airflow.utils.helpers import AirflowImporter
airflow_importer = AirflowImporter(sys.modules[__name__], _hooks)


def _integrate_plugins():
"""Integrate plugins to the context"""
import sys
Expand Down
1 change: 1 addition & 0 deletions airflow/hooks/druid_hook.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
LOAD_CHECK_INTERVAL = 5
DEFAULT_TARGET_PARTITION_SIZE = 5000000


class AirflowDruidLoadException(AirflowException):
pass

Expand Down
1 change: 1 addition & 0 deletions airflow/hooks/mysql_hook.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

from airflow.hooks.dbapi_hook import DbApiHook


class MySqlHook(DbApiHook):
'''
Interact with MySQL.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,10 @@
branch_labels = None
depends_on = None


def upgrade():
pass


def downgrade():
pass
pass
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,6 @@
def upgrade():
op.create_index('ti_state', 'task_instance', ['state'], unique=False)


def downgrade():
op.drop_index('ti_state', table_name='task_instance')
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
import sqlalchemy as sa
from sqlalchemy.dialects import mysql


def upgrade():
### commands auto generated by Alembic - please adjust! ###
op.add_column('task_instance', sa.Column('operator', sa.String(length=1000), nullable=True))
Expand Down
1 change: 1 addition & 0 deletions airflow/migrations/versions/4446e08588_dagrun_start_end.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
from alembic import op
import sqlalchemy as sa


def upgrade():
op.add_column('dag_run', sa.Column('end_date', sa.DateTime(), nullable=True))
op.add_column('dag_run', sa.Column('start_date', sa.DateTime(), nullable=True))
Expand Down
1 change: 1 addition & 0 deletions airflow/operators/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@
from airflow.utils.helpers import AirflowImporter
airflow_importer = AirflowImporter(sys.modules[__name__], _operators)


def _integrate_plugins():
"""Integrate plugins to the context"""
import sys
Expand Down
1 change: 1 addition & 0 deletions airflow/operators/hive_to_mysql.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

from tempfile import NamedTemporaryFile


class HiveToMySqlTransfer(BaseOperator):
"""
Moves data from Hive to MySQL, note that for now the data is loaded
Expand Down
3 changes: 3 additions & 0 deletions airflow/plugins_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,11 @@

from airflow import configuration


class AirflowPluginException(Exception):
pass


class AirflowPlugin(object):
name = None
operators = []
Expand Down Expand Up @@ -89,6 +91,7 @@ def validate(cls):
logging.exception(e)
logging.error('Failed to import plugin ' + filepath)


def make_module(name, objects):
name = name.lower()
module = imp.new_module(name)
Expand Down
1 change: 1 addition & 0 deletions airflow/security/kerberos.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ def detect_conf_var():
finally:
f.close()


def run():
if configuration.get('kerberos','keytab') is None:
LOG.debug("Keytab renewer not starting, no keytab configured")
Expand Down
1 change: 1 addition & 0 deletions airflow/security/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ def get_fqdn(hostname_or_ip=None):

return fqdn


def principal_from_username(username):
realm = conf.get("security", "default_realm")
if '@' not in username and realm:
Expand Down
1 change: 1 addition & 0 deletions airflow/utils/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ def ask_yesno(question):
else:
print("Please respond by yes or no.")


def is_in(obj, l):
"""
Checks whether an object is one of the item in the list.
Expand Down
2 changes: 1 addition & 1 deletion airflow/utils/logging.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
from airflow import configuration
from airflow.exceptions import AirflowException


class LoggingMixin(object):
"""
Convenience super-class to have a logger configured with the class name
Expand Down Expand Up @@ -80,7 +81,6 @@ def read(self, remote_log_location, return_error=False):
logging.error(err)
return err if return_error else ''


def write(self, log, remote_log_location, append=False):
"""
Writes the log to the remote_log_location. Fails silently if no hook
Expand Down
2 changes: 2 additions & 0 deletions airflow/www/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,8 @@ def shutdown_session(exception=None):
return app

app = None


def cached_app(config=None):
global app
if not app:
Expand Down
1 change: 1 addition & 0 deletions airflow/www/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,7 @@ def json_response(obj):
status=200,
mimetype="application/json")


def gzipped(f):
'''
Decorator to make a view compressed
Expand Down
1 change: 1 addition & 0 deletions airflow/www/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -1795,6 +1795,7 @@ class SlaMissModelView(wwwutils.SuperUserMixin, ModelViewOnly):
'timestamp': {'disabled': True},
}


class ChartModelView(wwwutils.DataProfilingMixin, AirflowModelView):
verbose_name = "chart"
verbose_name_plural = "charts"
Expand Down

0 comments on commit 6c7c52c

Please sign in to comment.