Skip to content

Commit 5ffe976

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent edb6691 commit 5ffe976

File tree

1 file changed

+11
-13
lines changed

1 file changed

+11
-13
lines changed

orbiter_translations/talend/talend_demo.py

+11-13
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
from __future__ import annotations
2-
from copy import deepcopy
32
from pathlib import Path
43

54
import inflection
6-
import jq
75

86
from orbiter.file_types import FileTypeJSON
97
from orbiter.objects.include import OrbiterInclude
@@ -36,7 +34,7 @@
3634
def dag_filter_rule(val) -> list[dict] | None:
3735

3836
if isinstance(val, dict) and "userFlow" in val:
39-
return [val["userFlow"]]
37+
return [val["userFlow"]]
4038
return None
4139

4240

@@ -61,7 +59,7 @@ def task_common_args(val: dict) -> dict:
6159
.get("properties", {})
6260
.get("$componentMetadata", {})
6361
.get("name", "UNKNOWN"))
64-
62+
6563
params = {
6664
"task_id": task_id.replace(" ", "_"),
6765
}
@@ -71,7 +69,7 @@ def task_common_args(val: dict) -> dict:
7169
# noinspection t
7270
@task_filter_rule
7371
def task_filter_rule(val: dict) -> list[dict] | None:
74-
72+
7573
if isinstance(val, dict) and "pipelines" in val:
7674
components = []
7775
for pipeline in val["pipelines"]:
@@ -82,7 +80,7 @@ def task_filter_rule(val: dict) -> list[dict] | None:
8280

8381
@task_rule(priority=2)
8482
def python_task_rule(val: dict) -> OrbiterPythonOperator | None:
85-
83+
8684
if "python3" in val.get("data", {}).get("properties", {}).get("$componentMetadata", {}).get("technicalType", "").lower():
8785
code = val.get("data", {}).get("properties", {}).get("configuration", {}).get("pythonCode", "")
8886
name = val.get("data", {}).get("properties", {}).get("$componentMetadata", {}).get("name", "").lower().replace(" ", "_")
@@ -123,7 +121,7 @@ def simple_task_dependencies(
123121
"""Extract task dependencies from Talend pipeline steps."""
124122
dependencies = []
125123
pipeline = val.orbiter_kwargs.get("val", {}).get("pipelines", [{}])[0]
126-
124+
127125
component_to_task_name = {}
128126
for component in pipeline.get("components", []):
129127
name = (component.get("data", {})
@@ -139,27 +137,27 @@ def simple_task_dependencies(
139137
.get("properties", {})
140138
.get("type"))
141139
port_to_component[port["id"]] = (port["nodeId"], port_type)
142-
140+
143141
for step in pipeline.get("steps", []):
144142
source_port = step["sourceId"]
145143
target_port = step["targetId"]
146-
144+
147145
if source_port in port_to_component and target_port in port_to_component:
148146
source_component_id, source_type = port_to_component[source_port]
149147
target_component_id, target_type = port_to_component[target_port]
150-
148+
151149
if source_type != "OUTGOING" or target_type != "INCOMING":
152150
continue
153-
151+
154152
source_task_name = component_to_task_name.get(source_component_id)
155153
target_task_name = component_to_task_name.get(target_component_id)
156-
154+
157155
if source_task_name and target_task_name:
158156
dependencies.append(OrbiterTaskDependency(
159157
task_id=source_task_name,
160158
downstream=target_task_name
161159
))
162-
160+
163161
return dependencies if dependencies else None
164162

165163

0 commit comments

Comments
 (0)