Skip to content

Commit 367417a

Browse files
committed
fix(mlops): Return a real bool from _is_collection_column; drop stale patch
Two unit-test failures introduced by the lint pass: - feature_utils._is_collection_column is annotated ``-> bool`` but returned ``Series.any()``, a numpy.bool_. The tests compared with ``== True``; changing them to ``is True`` (E712) exposed the mismatch. Wrap the result in ``bool()`` so the function honours its annotation. - test_feature_scheduler.test_to_pipeline patched ``_config_uploader.TrainingInput``, a name that module imported but never used. Removing the unused import (F401) made the patch fail with AttributeError. The patch never affected the test (the mock argument was unused), so the decorator and its parameter are removed.
1 parent 96eef7c commit 367417a

2 files changed

Lines changed: 1 addition & 3 deletions

File tree

‎sagemaker-mlops/src/sagemaker/mlops/feature_store/feature_utils.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -374,7 +374,7 @@ def get_session_from_role(region: str, assume_role: str = None) -> Session:
374374
def _is_collection_column(series: Series, sample_size: int = 1000) -> bool:
375375
"""Check if column contains list/set values."""
376376
sample = series.head(sample_size).dropna()
377-
return sample.apply(lambda x: isinstance(x, (list, set))).any()
377+
return bool(sample.apply(lambda x: isinstance(x, (list, set))).any())
378378

379379

380380
def _generate_feature_definition(

‎sagemaker-mlops/tests/unit/sagemaker/mlops/feature_store/feature_processor/test_feature_scheduler.py‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,6 @@ def config_uploader():
176176
"sagemaker.mlops.feature_store.feature_processor.feature_scheduler._get_spark_image_uri",
177177
return_value="some_image_uri",
178178
)
179-
@patch("sagemaker.mlops.feature_store.feature_processor._config_uploader.TrainingInput")
180179
@patch("sagemaker.mlops.feature_store.feature_processor.feature_scheduler.TrainingStep")
181180
@patch("sagemaker.mlops.feature_store.feature_processor.feature_scheduler.ModelTrainer")
182181
@patch(
@@ -228,7 +227,6 @@ def test_to_pipeline(
228227
mock_spark_dependency_upload,
229228
mock_model_trainer,
230229
mock_training_step,
231-
mock_training_input,
232230
mock_spark_image,
233231
pipeline,
234232
lineage_validator,

0 commit comments

Comments
 (0)