Skip to content

Commit b1ff18c

Browse files
Fix Ruff rule B028
1 parent 652ad77 commit b1ff18c

File tree

3 files changed

+9
-5
lines changed

3 files changed

+9
-5
lines changed

tfx/orchestration/airflow/airflow_dag_runner.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,9 @@ def __init__(self,
6464
if config and not isinstance(config, AirflowPipelineConfig):
6565
warnings.warn(
6666
'Pass config as a dict type is going to deprecated in 0.1.16. '
67-
'Use AirflowPipelineConfig type instead.', PendingDeprecationWarning)
67+
'Use AirflowPipelineConfig type instead.',
68+
PendingDeprecationWarning,
69+
stacklevel=2)
6870
config = AirflowPipelineConfig(airflow_dag_config=config)
6971
super().__init__(config)
7072

@@ -123,7 +125,7 @@ def _replace_runtime_params(self, comp):
123125
for k, prop in comp.exec_properties.copy().items():
124126
if isinstance(prop, RuntimeParameter):
125127
# Airflow only supports string parameters.
126-
if prop.ptype != str:
128+
if prop.ptype is not str:
127129
raise RuntimeError(
128130
f'RuntimeParameter in Airflow does not support {prop.ptype}. The'
129131
'only ptype supported is string.')

tfx/orchestration/pipeline.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -414,7 +414,8 @@ def _persist_dsl_context_registry(self):
414414
'This is probably due to reusing component from another pipeline '
415415
'or interleaved pipeline definitions. Make sure each component '
416416
'belong to exactly one pipeline, and pipeline definitions are '
417-
'separated.')
417+
'separated.',
418+
stacklevel=2)
418419

419420
@property
420421
def inputs(self) -> Dict[str, Any]:
@@ -507,5 +508,6 @@ def enumerate_implicit_dependencies(
507508
warnings.warn(
508509
f'Node {component.id} depends on the output of node'
509510
f' {upstream_node_id}, but {upstream_node_id} is not included in'
510-
' the components of pipeline. Did you forget to add it?'
511+
' the components of pipeline. Did you forget to add it?',
512+
stacklevel=2
511513
)

tfx/utils/deprecation_utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,4 +185,4 @@ class TfxDeprecationWarning(DeprecationWarning): # pylint: disable=g-bad-except
185185

186186
def warn_deprecated(msg):
187187
"""Convenient method to warn TfxDeprecationWarning."""
188-
warnings.warn(msg, TfxDeprecationWarning)
188+
warnings.warn(msg, TfxDeprecationWarning, stacklevel=2)

0 commit comments

Comments
 (0)