Skip to content

Commit 2f6a67d

Browse files
committed
Fix Ruff B008
1 parent dc27c84 commit 2f6a67d

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed

tfx/dsl/component/experimental/decorators_test.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
from tfx.types.system_executions import SystemExecution
4343

4444
_TestBeamPipelineArgs = ['--my_testing_beam_pipeline_args=foo']
45+
_TestEmptyBeamPipeline = beam.Pipeline()
4546

4647

4748
class _InputArtifact(types.Artifact):
@@ -140,10 +141,8 @@ def verify_beam_pipeline_arg(a: int) -> OutputDict(b=float): # pytype: disable=
140141

141142
def verify_beam_pipeline_arg_non_none_default_value(
142143
a: int,
143-
beam_pipeline: BeamComponentParameter[beam.Pipeline] = 0,
144+
beam_pipeline: BeamComponentParameter[beam.Pipeline] = _TestEmptyBeamPipeline,
144145
) -> OutputDict(b=float): # pytype: disable=invalid-annotation,wrong-arg-types
145-
if beam_pipeline == 0:
146-
beam_pipeline = beam.Pipeline()
147146
del beam_pipeline
148147
return {'b': float(a)}
149148

tfx/dsl/component/experimental/decorators_typeddict_test.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
from tfx.types.system_executions import SystemExecution
4141

4242
_TestBeamPipelineArgs = ['--my_testing_beam_pipeline_args=foo']
43+
_TestEmptyBeamPipeline = beam.Pipeline()
4344

4445

4546
class _InputArtifact(types.Artifact):
@@ -140,10 +141,8 @@ def verify_beam_pipeline_arg(a: int) -> TypedDict('Output6', dict(b=float)): #
140141

141142
def verify_beam_pipeline_arg_non_none_default_value(
142143
a: int,
143-
beam_pipeline: BeamComponentParameter[beam.Pipeline] = 0,
144+
beam_pipeline: BeamComponentParameter[beam.Pipeline] = _TestEmptyBeamPipeline,
144145
) -> TypedDict('Output7', dict(b=float)): # pytype: disable=wrong-arg-types
145-
if beam_pipeline == 0:
146-
beam_pipeline = beam.Pipeline()
147146
del beam_pipeline
148147
return {'b': float(a)}
149148

0 commit comments

Comments
 (0)