This is an automated email from the ASF dual-hosted git repository.
potiuk 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 325b88603a Completed D400 for airflow/lineage/* directory (#27732)
325b88603a is described below
commit 325b88603a863c0a1e885bb00452b2582f57aded
Author: Dov Benyomin Sohacheski <[email protected]>
AuthorDate: Thu Nov 17 13:26:40 2022 +0200
Completed D400 for airflow/lineage/* directory (#27732)
---
airflow/lineage/__init__.py | 12 ++++++++----
airflow/lineage/backend.py | 6 +++---
airflow/lineage/entities.py | 14 ++++++--------
3 files changed, 17 insertions(+), 15 deletions(-)
diff --git a/airflow/lineage/__init__.py b/airflow/lineage/__init__.py
index d7eff79147..045631552f 100644
--- a/airflow/lineage/__init__.py
+++ b/airflow/lineage/__init__.py
@@ -15,7 +15,7 @@
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
-"""Provides lineage support functions"""
+"""Provides lineage support functions."""
from __future__ import annotations
import itertools
@@ -41,7 +41,7 @@ log = logging.getLogger(__name__)
def get_backend() -> LineageBackend | None:
- """Gets the lineage backend if defined in the configs"""
+ """Gets the lineage backend if defined in the configs."""
clazz = conf.getimport("lineage", "backend", fallback=None)
if clazz:
@@ -69,7 +69,7 @@ def _deserialize(serialized: dict):
def _serialize(objs: list[Any], source: str):
- """Serialize an attrs-decorated class to JSON"""
+ """Serialize an attrs-decorated class to JSON."""
from airflow.serialization.serialized_objects import BaseSerialization
for obj in objs:
@@ -95,6 +95,8 @@ T = TypeVar("T", bound=Callable)
def apply_lineage(func: T) -> T:
"""
+ Conditionally send lineage to the backend.
+
Saves the lineage to XCom and if configured to do so sends it
to the backend.
"""
@@ -129,7 +131,9 @@ def apply_lineage(func: T) -> T:
def prepare_lineage(func: T) -> T:
"""
- Prepares the lineage inlets and outlets. Inlets can be:
+ Prepares the lineage inlets and outlets.
+
+ Inlets can be:
* "auto" -> picks up any outlets from direct upstream tasks that have
outlets defined, as such that
if A -> B -> C and B does not have outlets but A does, these are
provided as inlets.
diff --git a/airflow/lineage/backend.py b/airflow/lineage/backend.py
index ffb5d214c3..29a755109c 100644
--- a/airflow/lineage/backend.py
+++ b/airflow/lineage/backend.py
@@ -15,7 +15,7 @@
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
-"""Sends lineage metadata to a backend"""
+"""Sends lineage metadata to a backend."""
from __future__ import annotations
from typing import TYPE_CHECKING
@@ -25,7 +25,7 @@ if TYPE_CHECKING:
class LineageBackend:
- """Sends lineage metadata to a backend"""
+ """Sends lineage metadata to a backend."""
def send_lineage(
self,
@@ -35,7 +35,7 @@ class LineageBackend:
context: dict | None = None,
):
"""
- Sends lineage metadata to a backend
+ Sends lineage metadata to a backend.
:param operator: the operator executing a transformation on the inlets
and outlets
:param inlets: the inlets to this operator
diff --git a/airflow/lineage/entities.py b/airflow/lineage/entities.py
index eaa630ad1a..c52dc4cfd0 100644
--- a/airflow/lineage/entities.py
+++ b/airflow/lineage/entities.py
@@ -15,10 +15,7 @@
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
-"""
-Defines the base entities that can be used for providing lineage
-information.
-"""
+"""Defines base entities used for providing lineage information."""
from __future__ import annotations
from typing import Any, ClassVar
@@ -28,7 +25,7 @@ import attr
@attr.s(auto_attribs=True)
class File:
- """File entity. Refers to a file"""
+ """File entity. Refers to a file."""
template_fields: ClassVar = ("url",)
@@ -38,7 +35,7 @@ class File:
@attr.s(auto_attribs=True, kw_only=True)
class User:
- """User entity. Identifies a user"""
+ """User entity. Identifies a user."""
email: str = attr.ib()
first_name: str | None = None
@@ -58,7 +55,7 @@ class Tag:
@attr.s(auto_attribs=True, kw_only=True)
class Column:
- """Column of a Table"""
+ """Column of a Table."""
name: str = attr.ib()
description: str | None = None
@@ -74,12 +71,13 @@ class Column:
def default_if_none(arg: bool | None) -> bool:
+ """Get default value when None."""
return arg or False
@attr.s(auto_attribs=True, kw_only=True)
class Table:
- """Table entity"""
+ """Table entity."""
database: str = attr.ib()
cluster: str = attr.ib()