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 b780c2b chore: Refactor code quality issues (#14920)
b780c2b is described below
commit b780c2b675e67db7392ff3888d7c93d8fde98d83
Author: Ankit Dobhal <[email protected]>
AuthorDate: Tue Mar 23 15:39:39 2021 +0530
chore: Refactor code quality issues (#14920)
Signed-off-by: ankitdobhal <[email protected]>
* Remove duplicate elements during set declaration
Signed-off-by: ankitdobhal <[email protected]>
* Remove redundant 'None' default
Signed-off-by: ankitdobhal <[email protected]>
---
airflow/cli/simple_table.py | 2 +-
airflow/models/dag.py | 3 ---
airflow/models/taskinstance.py | 2 --
airflow/sensors/smart_sensor.py | 4 ++--
4 files changed, 3 insertions(+), 8 deletions(-)
diff --git a/airflow/cli/simple_table.py b/airflow/cli/simple_table.py
index fbbb0c0..515571c 100644
--- a/airflow/cli/simple_table.py
+++ b/airflow/cli/simple_table.py
@@ -127,5 +127,5 @@ class SimpleTable(Table):
def add_column(self, *args, **kwargs) -> None: # pylint:
disable=signature-differs
"""Add a column to the table. We use different default"""
- kwargs["overflow"] = kwargs.get("overflow", None) # to avoid
truncating
+ kwargs["overflow"] = kwargs.get("overflow") # to avoid truncating
super().add_column(*args, **kwargs)
diff --git a/airflow/models/dag.py b/airflow/models/dag.py
index 25a87bb..de110fa 100644
--- a/airflow/models/dag.py
+++ b/airflow/models/dag.py
@@ -2029,7 +2029,6 @@ class DAG(LoggingMixin):
'user_defined_filters',
'user_defined_macros',
'partial',
- '_old_context_manager_dags',
'_pickle_id',
'_log',
'is_subdag',
@@ -2335,8 +2334,6 @@ def dag(*dag_args, **dag_kwargs):
STATICA_HACK = True
globals()['kcah_acitats'[::-1].upper()] = False
if STATICA_HACK: # pragma: no cover
- # Let pylint know about these relationships, without introducing an import
cycle
- from sqlalchemy.orm import relationship
from airflow.models.serialized_dag import SerializedDagModel
diff --git a/airflow/models/taskinstance.py b/airflow/models/taskinstance.py
index cea741b..21a255e 100644
--- a/airflow/models/taskinstance.py
+++ b/airflow/models/taskinstance.py
@@ -2155,8 +2155,6 @@ class SimpleTaskInstance:
STATICA_HACK = True
globals()['kcah_acitats'[::-1].upper()] = False
if STATICA_HACK: # pragma: no cover
- # Let pylint know about these relationships, without introducing an import
cycle
- from sqlalchemy.orm import relationship
from airflow.job.base_job import BaseJob
from airflow.models.dagrun import DagRun
diff --git a/airflow/sensors/smart_sensor.py b/airflow/sensors/smart_sensor.py
index ef21b85..9fcfd26 100644
--- a/airflow/sensors/smart_sensor.py
+++ b/airflow/sensors/smart_sensor.py
@@ -672,13 +672,13 @@ class SmartSensorOperator(BaseOperator, SkipMixin):
def flush_cached_sensor_poke_results(self):
"""Flush outdated cached sensor states saved in previous loop."""
- for key, cached_work in self.cached_dedup_works.items():
+ for key, cached_work in self.cached_dedup_works.copy().items():
if cached_work.is_expired():
self.cached_dedup_works.pop(key, None)
else:
cached_work.state = None
- for ti_key, sensor_exception in self.cached_sensor_exceptions.items():
+ for ti_key, sensor_exception in
self.cached_sensor_exceptions.copy().items():
if sensor_exception.fail_current_run or
sensor_exception.is_expired():
self.cached_sensor_exceptions.pop(ti_key, None)