From b43e55c8dc22020a06050660bcadeac1817b74dc Mon Sep 17 00:00:00 2001 From: smokestacklightnin <125844868+smokestacklightnin@users.noreply.github.com> Date: Sat, 26 Oct 2024 18:02:44 -0700 Subject: [PATCH] Fix Ruff rule B023 --- tfx/components/example_diff/executor.py | 6 +++++- tfx/dsl/placeholder/proto_placeholder.py | 4 ++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/tfx/components/example_diff/executor.py b/tfx/components/example_diff/executor.py index ca888035ec..e805cbb920 100644 --- a/tfx/components/example_diff/executor.py +++ b/tfx/components/example_diff/executor.py @@ -175,7 +175,11 @@ def Do(self, input_dict: Dict[str, List[types.Artifact]], logging.info('Processing split pair %s', split_pair) # pylint: disable=cell-var-from-loop @beam.ptransform_fn - def _iteration(p): + def _iteration(p, + test_tfxio=test_tfxio, + base_tfxio=base_tfxio, + split_pair=split_pair + ): base_examples = ( p | 'TFXIORead[base]' >> test_tfxio.RawRecordBeamSource() | 'Parse[base]' >> beam.Map(_parse_example)) diff --git a/tfx/dsl/placeholder/proto_placeholder.py b/tfx/dsl/placeholder/proto_placeholder.py index ebb79ca183..d677fffadf 100644 --- a/tfx/dsl/placeholder/proto_placeholder.py +++ b/tfx/dsl/placeholder/proto_placeholder.py @@ -509,11 +509,11 @@ def _purge_types( _purge_types(name_prefix, message_descriptor) # Step 2 _remove_unless( file_descriptor.message_type, - lambda m: f'{name_prefix}.{m.name}' in self._keep_types, # pylint: disable=cell-var-from-loop + lambda m, name_prefix=name_prefix: f'{name_prefix}.{m.name}' in self._keep_types, # pylint: disable=cell-var-from-loop ) _remove_unless( file_descriptor.enum_type, - lambda e: f'{name_prefix}.{e.name}' in self._keep_types, # pylint: disable=cell-var-from-loop + lambda e, name_prefix=name_prefix: f'{name_prefix}.{e.name}' in self._keep_types, # pylint: disable=cell-var-from-loop ) # Step 4: Remove file descriptors that became empty. Remove declared