130def print_diff(inp_dict, ref_dict, matching_only=False):
131 retcode = 0
132 chains_not_in_ref = [c[0] for c in inp_dict.items() if c[0] not in ref_dict]
133 chains_not_in_inp = [c[0] for c in ref_dict.items() if c[0] not in inp_dict]
134 chains_count_diff = [c[0] for c in inp_dict.items() if c[0] in ref_dict and c[1] != ref_dict[c[0]]]
135
136
137 n_new_chains = len(chains_not_in_ref)
138 if n_new_chains > 0 and not matching_only:
139 retcode = 1
140 logging.info('Found %d new chain%s added:', n_new_chains, 's' if n_new_chains > 1 else '')
141 for chain_name in chains_not_in_ref:
142 logging.info(' %s', chain_name)
143
144
145 n_removed_chains = len(chains_not_in_inp)
146 if n_removed_chains > 0 and not matching_only:
147 retcode = 1
148 logging.info('Found %d chain%s removed:', n_removed_chains, 's' if n_removed_chains > 1 else '')
149 for chain_name in chains_not_in_inp:
150 logging.info(' %s', chain_name)
151
152
153 n_diff_chains = len(chains_count_diff)
154 if n_diff_chains > 0:
155 retcode = 1
156 logging.info('Found %d chain%s with count differences:', n_diff_chains, 's' if n_diff_chains > 1 else '')
157 for chain_name in chains_count_diff:
158 logging.info(' %s:', chain_name)
159 inp_data = inp_dict[chain_name]
160 ref_data = ref_dict[chain_name]
161 print_event_diff(inp_data, ref_data, 'eventCount')
162 print_step_diff(inp_data, ref_data, 'stepCounts')
163 print_step_diff(inp_data, ref_data, 'stepFeatures')
164
165 return retcode
166
167