

def __load_history(self):
    self.history = {
        
    }
    if (not os.path.exists(self.HISTORY_FILE)):
        self.debug(("History file '%s' doesn't exist" % self.HISTORY_FILE))
        return
    self.debug(('Loading the history from file ' + self.HISTORY_FILE))
    try:
        with open(self.HISTORY_FILE, 'r') as f:
            updated_history = json.load(f)
    except Exception as e:
        updated_history = {
            
        }
        sublime.error_message((dedent("                       File History could not read your history file at '%s'.\n\n                       %s: %s") % (self.HISTORY_FILE, e.__class__.__name__, e)))
    self.history = updated_history
    self.__ensure_project('global')
    trigger_save = False
    hlist = (updated_history['global']['closed'] or updated_history['global']['opened'])
    if (hlist and ('timestamp' in hlist[0]) and (not isinstance(hlist[0]['timestamp'], int))):
        self.debug('Found an old-style formatted timestamp. Migrating to POSIX')
        for project in updated_history.values():
            for key in ('closed', 'opened'):
                for entry in project[key]:
                    if (not isinstance(entry.get('timestamp', 0), int)):
                        new_stamp = self.timestamp_from_string(entry['timestamp'])
                        if (not new_stamp):
                            del entry['timestamp']
                        else:
                            entry['timestamp'] = new_stamp
        trigger_save = True
    if (hlist and ('action' in hlist[0])):
        self.debug('Found an old-style action field. Cleaning up')
        trigger_save = True
        for project in updated_history.values():
            for key in ('closed', 'opened'):
                for entry in project[key]:
                    if ('action' in entry):
                        del entry['action']
    if trigger_save:
        self.__save_history()

dataset/ETHPy150Open FichteFoll/FileHistory/file_history.py FileHistory.__load_history/original