def _from_tree_type_changes(self, tree): if 'type_changes' in tree: for change in tree['type_changes']: include_values = None if type(change.t1) is type: include_values = False old_type = change.t1 new_type = change.t2 else: old_type = get_type(change.t1) new_type = get_type(change.t2) include_values = True try: if new_type in numpy_numbers: new_t1 = change.t1.astype(new_type) include_values = not np.array_equal( new_t1, change.t2) else: new_t1 = new_type(change.t1) # If simply applying the type from one value converts it to the other value, # there is no need to include the actual values in the delta. include_values = new_t1 != change.t2 except Exception: pass remap_dict = RemapDict({ 'old_type': old_type, 'new_type': new_type }) self['type_changes'][change.path( force=FORCE_DEFAULT)] = remap_dict if include_values: remap_dict.update(old_value=change.t1, new_value=change.t2)
def _from_tree_type_changes(self, tree): if 'type_changes' in tree: for change in tree['type_changes']: remap_dict = RemapDict({ 'old_type': type(change.t1), 'new_type': type(change.t2) }) self['type_changes'][change.path( force=FORCE_DEFAULT)] = remap_dict if Verbose.level: remap_dict.update(old_value=change.t1, new_value=change.t2)
def _from_tree_type_changes(self, tree): if 'type_changes' in tree: for change in tree['type_changes']: if type(change.t1) is type: include_values = False old_type = change.t1 new_type = change.t2 else: include_values = True old_type = type(change.t1) new_type = type(change.t2) remap_dict = RemapDict({ 'old_type': old_type, 'new_type': new_type }) self['type_changes'][change.path( force=FORCE_DEFAULT)] = remap_dict if Verbose.level and include_values: remap_dict.update(old_value=change.t1, new_value=change.t2)