This is an automated email from the ASF dual-hosted git repository.
taragolis pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git
The following commit(s) were added to refs/heads/main by this push:
new a3e2cf7067 D105 checks - airflow.ti_deps (#37578)
a3e2cf7067 is described below
commit a3e2cf70678cfa6b1abd4b82c961b9f1168bb42b
Author: Satoshi S <[email protected]>
AuthorDate: Wed Feb 21 09:33:07 2024 -0600
D105 checks - airflow.ti_deps (#37578)
* Added docstring to airflow.ti_deps
* clarify object(s)/instance(s) by task instance dependency
---
airflow/ti_deps/deps/base_ti_dep.py | 3 +++
airflow/ti_deps/deps/task_not_running_dep.py | 2 ++
airflow/ti_deps/deps/valid_state_dep.py | 2 ++
pyproject.toml | 3 ---
4 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/airflow/ti_deps/deps/base_ti_dep.py
b/airflow/ti_deps/deps/base_ti_dep.py
index ef18f3fcdf..f92d00ddea 100644
--- a/airflow/ti_deps/deps/base_ti_dep.py
+++ b/airflow/ti_deps/deps/base_ti_dep.py
@@ -46,12 +46,15 @@ class BaseTIDep:
IS_TASK_DEP = False
def __eq__(self, other: Any) -> bool:
+ """Check if two task instance dependencies are equal by comparing
their types."""
return isinstance(self, type(other))
def __hash__(self) -> int:
+ """Compute the hash value based on the task instance dependency
type."""
return hash(type(self))
def __repr__(self) -> str:
+ """Return a string representation of the task instance dependency."""
return f"<TIDep({self.name})>"
@property
diff --git a/airflow/ti_deps/deps/task_not_running_dep.py
b/airflow/ti_deps/deps/task_not_running_dep.py
index 7299a4f3e2..eaecb811a4 100644
--- a/airflow/ti_deps/deps/task_not_running_dep.py
+++ b/airflow/ti_deps/deps/task_not_running_dep.py
@@ -30,9 +30,11 @@ class TaskNotRunningDep(BaseTIDep):
IGNORABLE = False
def __eq__(self, other):
+ """Check if two task instance dependencies are of the same type."""
return type(self) == type(other)
def __hash__(self):
+ """Compute the hash value based on the type of the task instance
dependency."""
return hash(type(self))
@provide_session
diff --git a/airflow/ti_deps/deps/valid_state_dep.py
b/airflow/ti_deps/deps/valid_state_dep.py
index e4a8a67829..3170882e67 100644
--- a/airflow/ti_deps/deps/valid_state_dep.py
+++ b/airflow/ti_deps/deps/valid_state_dep.py
@@ -42,9 +42,11 @@ class ValidStateDep(BaseTIDep):
self._valid_states = valid_states
def __eq__(self, other):
+ """Check if two task instance dependencies are equal by comparing
their types and valid states."""
return isinstance(self, type(other)) and self._valid_states ==
other._valid_states
def __hash__(self):
+ """Compute the hash value based on the type of the task instance
dependency and its valid states."""
return hash((type(self), tuple(self._valid_states)))
@provide_session
diff --git a/pyproject.toml b/pyproject.toml
index 2947342512..cbcd2e2d3c 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -1421,9 +1421,6 @@ combine-as-imports = true
"airflow/providers_manager.py" = ["D105"]
"airflow/sensors/base.py" = ["D105"]
"airflow/sensors/external_task.py" = ["D105"]
-"airflow/ti_deps/deps/base_ti_dep.py" = ["D105"]
-"airflow/ti_deps/deps/task_not_running_dep.py" = ["D105"]
-"airflow/ti_deps/deps/valid_state_dep.py" = ["D105"]
"airflow/timetables/events.py" = ["D105"]
"airflow/triggers/base.py" = ["D105"]
"airflow/utils/context.py" = ["D105"]