MCPcopy
hub / github.com/feast-dev/feast / diff_between

Function diff_between

sdk/python/feast/diff/infra_diff.py:203–229  ·  view source on GitHub ↗
(
    current: InfraObjectProto, new: InfraObjectProto, infra_object_type: str
)

Source from the content-addressed store, hash-verified

201
202
203def diff_between(
204 current: InfraObjectProto, new: InfraObjectProto, infra_object_type: str
205) -> InfraObjectDiff:
206 assert current.DESCRIPTOR.full_name == new.DESCRIPTOR.full_name
207 property_diffs = []
208 transition: TransitionType = TransitionType.UNCHANGED
209 if current != new:
210 for _field in current.DESCRIPTOR.fields:
211 if _field.name in FIELDS_TO_IGNORE:
212 continue
213 if getattr(current, _field.name) != getattr(new, _field.name):
214 transition = TransitionType.UPDATE
215 property_diffs.append(
216 PropertyDiff(
217 _field.name,
218 getattr(current, _field.name),
219 getattr(new, _field.name),
220 )
221 )
222 return InfraObjectDiff(
223 new.name,
224 infra_object_type,
225 current,
226 new,
227 property_diffs,
228 transition,
229 )

Callers 2

diff_infra_protosFunction · 0.70

Calls 2

PropertyDiffClass · 0.90
InfraObjectDiffClass · 0.85

Tested by 1