MCPcopy Index your code
hub / github.com/feast-dev/feast / __getitem__

Method __getitem__

sdk/python/feast/base_feature_view.py:141–160  ·  view source on GitHub ↗
(self, item)

Source from the content-addressed store, hash-verified

139 return hash(self.name)
140
141 def __getitem__(self, item):
142 assert isinstance(item, list)
143
144 cp = self.__copy__()
145 if self.features:
146 feature_name_to_feature = {
147 feature.name: feature for feature in self.features
148 }
149 referenced_features = []
150 for feature in item:
151 if feature not in feature_name_to_feature:
152 raise ValueError(
153 f"Feature {feature} does not exist in this feature view."
154 )
155 referenced_features.append(feature_name_to_feature[feature])
156 cp.projection.features = referenced_features
157 else:
158 cp.projection.desired_features = item
159
160 return cp
161
162 def _schema_or_udf_changed(self, other: "BaseFeatureView") -> bool:
163 """Check if schema or UDF-related fields have changed (version-worthy changes).

Callers

nothing calls this directly

Calls 1

__copy__Method · 0.95

Tested by

no test coverage detected