Skip to content
Prev Previous commit
Next Next commit
fix doc
Signed-off-by: HaoXuAI <sduxuhao@gmail.com>
  • Loading branch information
HaoXuAI committed Jul 13, 2025
commit 02377065c57c8053bb27e2e013042e3d4e22eabf
16 changes: 8 additions & 8 deletions sdk/python/feast/feature_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -377,23 +377,23 @@ def to_proto(self) -> FeatureViewProto:
"""
return self._to_proto_internal(seen={})

def _to_proto_internal(self, seen: Dict[str, FeatureViewProto]) -> FeatureViewProto:
def _to_proto_internal(self, seen: Dict[str, Union[None, FeatureViewProto]]) -> FeatureViewProto:
if self.name in seen:
if seen[self.name] is not None:
if seen[self.name] is None:
raise ValueError(
f"Cycle detected during serialization of FeatureView: {self.name}"
)
return seen[self.name]
return seen[self.name] # type: ignore[return-value]

seen[self.name] = None # type: ignore[assignment]
seen[self.name] = None

spec = self.to_proto_spec(seen)
meta = self.to_proto_meta()
proto = FeatureViewProto(spec=spec, meta=meta)
seen[self.name] = proto
return proto

def to_proto_spec(self, seen: Dict[str, FeatureViewProto]) -> FeatureViewSpecProto:
def to_proto_spec(self, seen: Dict[str, Union[None, FeatureViewProto]]) -> FeatureViewSpecProto:
ttl_duration = self.get_ttl_duration()

batch_source_proto = None
Expand Down Expand Up @@ -452,7 +452,7 @@ def from_proto(cls, feature_view_proto: FeatureViewProto) -> "FeatureView":

@classmethod
def _from_proto_internal(
cls, feature_view_proto: FeatureViewProto, seen: Dict[str, "FeatureView"]
cls, feature_view_proto: FeatureViewProto, seen: Dict[str, Union[None, "FeatureView"]]
) -> "FeatureView":
"""
Creates a feature view from a protobuf representation of a feature view.
Expand All @@ -471,8 +471,8 @@ def _from_proto_internal(
raise ValueError(
f"Cycle detected while deserializing FeatureView: {feature_view_name}"
)
return seen[feature_view_name]
seen[feature_view_name] = None # type: ignore[assignment]
return seen[feature_view_name] # type: ignore[return-value]
seen[feature_view_name] = None

batch_source = (
DataSource.from_proto(feature_view_proto.spec.batch_source)
Expand Down