Skip to content

Commit 79d6744

Browse files
Apply code formatting with ruff
Co-authored-by: franciscojavierarceo <4163062+franciscojavierarceo@users.noreply.github.com>
1 parent f9542e5 commit 79d6744

File tree

3 files changed

+29
-18
lines changed

3 files changed

+29
-18
lines changed

sdk/python/feast/feature_store.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,9 @@ def list_all_feature_views(
303303
Returns:
304304
A list of feature views.
305305
"""
306-
return self._list_all_feature_views(allow_cache, tags=tags, skip_validation=skip_validation)
306+
return self._list_all_feature_views(
307+
allow_cache, tags=tags, skip_validation=skip_validation
308+
)
307309

308310
def list_feature_views(
309311
self, allow_cache: bool = False, tags: Optional[dict[str, str]] = None
@@ -1966,7 +1968,9 @@ def _get_feature_view_and_df_for_online_write(
19661968
):
19671969
feature_view_dict = {
19681970
fv_proto.name: fv_proto
1969-
for fv_proto in self.list_all_feature_views(allow_registry_cache, skip_validation=skip_validation)
1971+
for fv_proto in self.list_all_feature_views(
1972+
allow_registry_cache, skip_validation=skip_validation
1973+
)
19701974
}
19711975
try:
19721976
feature_view = feature_view_dict[feature_view_name]

sdk/python/feast/infra/registry/proto_registry_utils.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,9 @@ def list_all_feature_views(
244244
return (
245245
list_feature_views(registry_proto, project, tags)
246246
+ list_stream_feature_views(registry_proto, project, tags)
247-
+ list_on_demand_feature_views(registry_proto, project, tags, skip_udf=skip_udf)
247+
+ list_on_demand_feature_views(
248+
registry_proto, project, tags, skip_udf=skip_udf
249+
)
248250
)
249251
else:
250252
return _list_all_feature_views_cached(registry_proto, project, tags)
@@ -303,7 +305,9 @@ def list_on_demand_feature_views(
303305
on_demand_feature_view.spec.tags, tags
304306
):
305307
on_demand_feature_views.append(
306-
OnDemandFeatureView.from_proto(on_demand_feature_view, skip_udf=skip_udf)
308+
OnDemandFeatureView.from_proto(
309+
on_demand_feature_view, skip_udf=skip_udf
310+
)
307311
)
308312
return on_demand_feature_views
309313
else:

sdk/python/tests/unit/test_skip_validation.py

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,9 @@
2020

2121
from feast.feature_store import FeatureStore
2222
from feast.on_demand_feature_view import PandasTransformation, PythonTransformation
23-
from feast.protos.feast.core.Transformation_pb2 import UserDefinedFunctionV2 as UserDefinedFunctionProto
23+
from feast.protos.feast.core.Transformation_pb2 import (
24+
UserDefinedFunctionV2 as UserDefinedFunctionProto,
25+
)
2426

2527

2628
def test_apply_has_skip_feature_view_validation_parameter():
@@ -93,32 +95,33 @@ def test_push_async_has_skip_validation_parameter():
9395

9496
def test_pandas_transformation_from_proto_with_skip_udf():
9597
"""Test that PandasTransformation.from_proto works with skip_udf=True."""
96-
98+
9799
# Create a UDF that would reference a non-existent module
98100
def udf_with_missing_module(df: pd.DataFrame) -> pd.DataFrame:
99101
# This would normally fail if a module is missing during deserialization
100102
import nonexistent_module # noqa: F401
103+
101104
return df
102-
105+
103106
# Serialize the UDF
104107
serialized_udf = dill.dumps(udf_with_missing_module)
105108
udf_string = "import nonexistent_module\ndef udf(df): return df"
106-
109+
107110
# Create proto
108111
udf_proto = UserDefinedFunctionProto(
109112
name="test_udf",
110113
body=serialized_udf,
111114
body_text=udf_string,
112115
)
113-
116+
114117
# Test that skip_udf=True doesn't try to deserialize the UDF
115118
# This would normally fail with ModuleNotFoundError
116119
transformation = PandasTransformation.from_proto(udf_proto, skip_udf=True)
117-
120+
118121
# Should get a dummy transformation with identity function
119122
assert transformation is not None
120123
assert transformation.udf_string == udf_string
121-
124+
122125
# The dummy UDF should be callable and act as identity
123126
test_df = pd.DataFrame({"col1": [1, 2, 3]})
124127
result = transformation.udf(test_df)
@@ -127,32 +130,33 @@ def udf_with_missing_module(df: pd.DataFrame) -> pd.DataFrame:
127130

128131
def test_python_transformation_from_proto_with_skip_udf():
129132
"""Test that PythonTransformation.from_proto works with skip_udf=True."""
130-
133+
131134
# Create a UDF that would reference a non-existent module
132135
def udf_with_missing_module(features_dict):
133136
# This would normally fail if a module is missing during deserialization
134137
import nonexistent_module # noqa: F401
138+
135139
return features_dict
136-
140+
137141
# Serialize the UDF
138142
serialized_udf = dill.dumps(udf_with_missing_module)
139143
udf_string = "import nonexistent_module\ndef udf(d): return d"
140-
144+
141145
# Create proto
142146
udf_proto = UserDefinedFunctionProto(
143147
name="test_udf",
144148
body=serialized_udf,
145149
body_text=udf_string,
146150
)
147-
151+
148152
# Test that skip_udf=True doesn't try to deserialize the UDF
149153
# This would normally fail with ModuleNotFoundError
150154
transformation = PythonTransformation.from_proto(udf_proto, skip_udf=True)
151-
155+
152156
# Should get a dummy transformation with identity function
153157
assert transformation is not None
154158
assert transformation.udf_string == udf_string
155-
159+
156160
# The dummy UDF should be callable and act as identity
157161
test_dict = {"col1": 1}
158162
result = transformation.udf(test_dict)
@@ -212,4 +216,3 @@ def test_skip_validation_use_case_documentation():
212216
- Different teams manage training vs. serving infrastructure
213217
"""
214218
pass # This is a documentation test
215-

0 commit comments

Comments
 (0)