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

Method to_string

sdk/python/feast/diff/infra_diff.py:68–94  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

66 infra_object.update()
67
68 def to_string(self):
69 from colorama import Fore, Style
70
71 log_string = ""
72
73 message_action_map = {
74 TransitionType.CREATE: ("Created", Fore.GREEN),
75 TransitionType.DELETE: ("Deleted", Fore.RED),
76 TransitionType.UNCHANGED: ("Unchanged", Fore.LIGHTBLUE_EX),
77 TransitionType.UPDATE: ("Updated", Fore.YELLOW),
78 }
79 for infra_object_diff in self.infra_object_diffs:
80 if infra_object_diff.transition_type == TransitionType.UNCHANGED:
81 continue
82 action, color = message_action_map[infra_object_diff.transition_type]
83 log_string += f"{action} {infra_object_diff.infra_object_type} {Style.BRIGHT + color}{infra_object_diff.name}{Style.RESET_ALL}\n"
84 if infra_object_diff.transition_type == TransitionType.UPDATE:
85 for _p in infra_object_diff.infra_object_property_diffs:
86 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"
87
88 log_string = (
89 f"{Style.BRIGHT + Fore.LIGHTBLUE_EX}No changes to infrastructure"
90 if not log_string
91 else log_string
92 )
93
94 return log_string
95
96
97def tag_infra_proto_objects_for_keep_delete_add(

Callers 3

planFunction · 0.45
run_demoFunction · 0.45

Calls

no outgoing calls

Tested by 1

run_demoFunction · 0.36