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

Class RegistryDiff

sdk/python/feast/diff/registry_diff.py:48–88  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

46
47@dataclass
48class RegistryDiff:
49 feast_object_diffs: List[FeastObjectDiff]
50
51 def __init__(self):
52 self.feast_object_diffs = []
53
54 def add_feast_object_diff(self, feast_object_diff: FeastObjectDiff):
55 self.feast_object_diffs.append(feast_object_diff)
56
57 def to_string(self):
58 from colorama import Fore, Style
59
60 log_string = ""
61
62 message_action_map = {
63 TransitionType.CREATE: ("Created", Fore.GREEN),
64 TransitionType.DELETE: ("Deleted", Fore.RED),
65 TransitionType.UNCHANGED: ("Unchanged", Fore.LIGHTBLUE_EX),
66 TransitionType.UPDATE: ("Updated", Fore.YELLOW),
67 }
68 for feast_object_diff in self.feast_object_diffs:
69 if feast_object_diff.name == DUMMY_ENTITY_NAME:
70 continue
71 if feast_object_diff.transition_type == TransitionType.UNCHANGED:
72 continue
73 if feast_object_diff.feast_object_type == FeastObjectType.DATA_SOURCE:
74 # TODO(adchia): Print statements out starting in Feast 0.24
75 continue
76 action, color = message_action_map[feast_object_diff.transition_type]
77 log_string += f"{action} {feast_object_diff.feast_object_type.value} {Style.BRIGHT + color}{feast_object_diff.name}{Style.RESET_ALL}\n"
78 if feast_object_diff.transition_type == TransitionType.UPDATE:
79 for _p in feast_object_diff.feast_object_property_diffs:
80 log_string += f"\t{_p.property_name}: {Style.BRIGHT + color}{_p.val_existing}{Style.RESET_ALL} -> {Style.BRIGHT + Fore.LIGHTGREEN_EX}{_p.val_declared}{Style.RESET_ALL}\n"
81
82 log_string = (
83 f"{Style.BRIGHT + Fore.LIGHTBLUE_EX}No changes to registry"
84 if not log_string
85 else log_string
86 )
87
88 return log_string
89
90
91def tag_objects_for_keep_delete_update_add(

Callers 1

diff_betweenFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected