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

kaxilnaik pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/airflow.git


The following commit(s) were added to refs/heads/master by this push:
     new 7c44518  Make experimental/endpoints.py Pylint compatible (#9287)
7c44518 is described below

commit 7c445183b94136841d22ecae7b9c9f0d6647a96f
Author: Kaxil Naik <[email protected]>
AuthorDate: Sun Jun 14 23:17:24 2020 +0100

    Make experimental/endpoints.py Pylint compatible (#9287)
---
 airflow/models/dagrun.py                  |  2 +-
 airflow/www/api/experimental/endpoints.py | 17 ++++++++++-------
 scripts/ci/pylint_todo.txt                |  1 -
 3 files changed, 11 insertions(+), 9 deletions(-)

diff --git a/airflow/models/dagrun.py b/airflow/models/dagrun.py
index 13a43fc..0cc03d9 100644
--- a/airflow/models/dagrun.py
+++ b/airflow/models/dagrun.py
@@ -495,7 +495,7 @@ class DagRun(Base, LoggingMixin):
 
     @classmethod
     @provide_session
-    def get_latest_runs(cls, session):
+    def get_latest_runs(cls, session=None):
         """Returns the latest DagRun for each DAG. """
         subquery = (
             session
diff --git a/airflow/www/api/experimental/endpoints.py 
b/airflow/www/api/experimental/endpoints.py
index de263bd..1f3ff25 100644
--- a/airflow/www/api/experimental/endpoints.py
+++ b/airflow/www/api/experimental/endpoints.py
@@ -140,12 +140,14 @@ def dag_runs(dag_id):
 @api_experimental.route('/test', methods=['GET'])
 @requires_authentication
 def test():
+    """ Test endpoint to check authentication """
     return jsonify(status='OK')
 
 
 @api_experimental.route('/info', methods=['GET'])
 @requires_authentication
 def info():
+    """ Get Airflow Version """
     return jsonify(version=version)
 
 
@@ -167,7 +169,7 @@ def get_dag_code(dag_id):
 def task_info(dag_id, task_id):
     """Returns a JSON with a task's public instance variables. """
     try:
-        info = get_task(dag_id, task_id)
+        t_info = get_task(dag_id, task_id)
     except AirflowException as err:
         log.info(err)
         response = jsonify(error="{}".format(err))
@@ -176,7 +178,7 @@ def task_info(dag_id, task_id):
 
     # JSONify and return.
     fields = {k: str(v)
-              for k, v in vars(info).items()
+              for k, v in vars(t_info).items()
               if not k.startswith('_')}
     return jsonify(fields)
 
@@ -187,7 +189,7 @@ def task_info(dag_id, task_id):
 def dag_paused(dag_id, paused):
     """(Un)pauses a dag"""
 
-    is_paused = True if paused == 'true' else False
+    is_paused = bool(paused == 'true')
 
     models.DagModel.get_dagmodel(dag_id).set_is_paused(
         is_paused=is_paused,
@@ -233,7 +235,7 @@ def task_instance_info(dag_id, execution_date, task_id):
         return response
 
     try:
-        info = get_task_instance(dag_id, task_id, execution_date)
+        ti_info = get_task_instance(dag_id, task_id, execution_date)
     except AirflowException as err:
         log.info(err)
         response = jsonify(error="{}".format(err))
@@ -242,7 +244,7 @@ def task_instance_info(dag_id, execution_date, task_id):
 
     # JSONify and return.
     fields = {k: str(v)
-              for k, v in vars(info).items()
+              for k, v in vars(ti_info).items()
               if not k.startswith('_')}
     return jsonify(fields)
 
@@ -274,14 +276,14 @@ def dag_run_status(dag_id, execution_date):
         return response
 
     try:
-        info = get_dag_run_state(dag_id, execution_date)
+        dr_info = get_dag_run_state(dag_id, execution_date)
     except AirflowException as err:
         log.info(err)
         response = jsonify(error="{}".format(err))
         response.status_code = err.status_code
         return response
 
-    return jsonify(info)
+    return jsonify(dr_info)
 
 
 @api_experimental.route('/latest_runs', methods=['GET'])
@@ -369,6 +371,7 @@ def delete_pool(name):
                         methods=['GET'])
 @requires_authentication
 def get_lineage(dag_id: str, execution_date: str):
+    """ Get Lineage details for a DagRun """
     # Convert string datetime into actual datetime
     try:
         execution_date = timezone.parse(execution_date)
diff --git a/scripts/ci/pylint_todo.txt b/scripts/ci/pylint_todo.txt
index 12b1134..234e55f 100644
--- a/scripts/ci/pylint_todo.txt
+++ b/scripts/ci/pylint_todo.txt
@@ -17,7 +17,6 @@
 ./airflow/models/variable.py
 ./airflow/models/xcom.py
 ./airflow/stats.py
-./airflow/www/api/experimental/endpoints.py
 ./airflow/www/blueprints.py
 ./airflow/www/decorators.py
 ./airflow/www/forms.py

Reply via email to